marko 6.0.117 → 6.0.119

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.
@@ -112,8 +112,8 @@ var attrs_default = {
112
112
  };
113
113
 
114
114
  // src/translator/core/await.ts
115
- var import_compiler36 = require("@marko/compiler");
116
- var import_babel_utils26 = require("@marko/compiler/babel-utils");
115
+ var import_compiler39 = require("@marko/compiler");
116
+ var import_babel_utils27 = require("@marko/compiler/babel-utils");
117
117
 
118
118
  // src/common/accessor.debug.ts
119
119
  var AccessorPrefix = /* @__PURE__ */ ((AccessorPrefix4) => {
@@ -248,8 +248,8 @@ function isNullableExpr(expr) {
248
248
  }
249
249
 
250
250
  // src/translator/util/references.ts
251
- var import_compiler35 = require("@marko/compiler");
252
- var import_babel_utils25 = require("@marko/compiler/babel-utils");
251
+ var import_compiler38 = require("@marko/compiler");
252
+ var import_babel_utils26 = require("@marko/compiler/babel-utils");
253
253
 
254
254
  // src/common/helpers.ts
255
255
  function classValue(classValue2) {
@@ -856,7 +856,16 @@ var import_babel_utils6 = require("@marko/compiler/babel-utils");
856
856
 
857
857
  // src/translator/util/get-tag-name.ts
858
858
  function getTagName(tag) {
859
- return tag.node.name.value;
859
+ switch (tag.node.name.type) {
860
+ case "StringLiteral":
861
+ return tag.node.name.value;
862
+ case "TemplateLiteral":
863
+ if (tag.node.name.quasis.length === 1) {
864
+ return tag.node.name.quasis[0].value.raw;
865
+ }
866
+ break;
867
+ }
868
+ return void 0;
860
869
  }
861
870
 
862
871
  // src/translator/util/is-core-tag.ts
@@ -869,13 +878,7 @@ function isCoreTag(tag) {
869
878
  if (tagDef) {
870
879
  switch (tagDef.taglibId) {
871
880
  case taglibId:
872
- return true;
873
881
  case interopTaglibId:
874
- switch (tagDef.name) {
875
- // The body tag is registered in the v5 translator, without this it'd be seen as a core tag.
876
- case "body":
877
- return false;
878
- }
879
882
  return true;
880
883
  case htmlTaglibId:
881
884
  switch (tagDef.name) {
@@ -1598,7 +1601,7 @@ function analyzeTagNameType(tag, allowDynamic) {
1598
1601
  if (name2.isStringLiteral()) {
1599
1602
  extra.tagNameType = name2.node.value[0] === "@" ? 3 /* AttributeTag */ : (0, import_babel_utils9.isNativeTag)(tag) ? 0 /* NativeTag */ : 1 /* CustomTag */;
1600
1603
  extra.tagNameNullable = extra.tagNameDynamic = false;
1601
- } else if (name2.isTemplateLiteral() && !name2.node.expressions.length) {
1604
+ } else if (name2.isTemplateLiteral() && name2.node.quasis.length === 1) {
1602
1605
  extra.tagNameType = 0 /* NativeTag */;
1603
1606
  extra.tagNameNullable = extra.tagNameDynamic = false;
1604
1607
  } else if (name2.isIdentifier()) {
@@ -1839,7 +1842,6 @@ function getNodeContentType(path5, extraMember, contentInfo) {
1839
1842
  return 0 /* Comment */;
1840
1843
  case "html-script":
1841
1844
  case "html-style":
1842
- case "title":
1843
1845
  return 3 /* Tag */;
1844
1846
  case "for":
1845
1847
  case "if":
@@ -1993,7 +1995,6 @@ function isNativeNode(tag) {
1993
1995
  case "html-comment":
1994
1996
  case "html-script":
1995
1997
  case "html-style":
1996
- case "title":
1997
1998
  return true;
1998
1999
  default:
1999
2000
  return false;
@@ -2217,11 +2218,11 @@ function isEventOrChangeHandler(prop) {
2217
2218
  }
2218
2219
 
2219
2220
  // src/translator/util/known-tag.ts
2220
- var import_compiler34 = require("@marko/compiler");
2221
- var import_babel_utils24 = require("@marko/compiler/babel-utils");
2221
+ var import_compiler37 = require("@marko/compiler");
2222
+ var import_babel_utils25 = require("@marko/compiler/babel-utils");
2222
2223
 
2223
2224
  // src/translator/visitors/program/index.ts
2224
- var import_compiler26 = require("@marko/compiler");
2225
+ var import_compiler27 = require("@marko/compiler");
2225
2226
  var import_babel_utils17 = require("@marko/compiler/babel-utils");
2226
2227
  var import_path2 = __toESM(require("path"));
2227
2228
 
@@ -4783,7 +4784,31 @@ function getRegisteredFnExpression2(node) {
4783
4784
  }
4784
4785
 
4785
4786
  // src/translator/visitors/program/pre-analyze.ts
4787
+ var import_compiler26 = require("@marko/compiler");
4788
+
4789
+ // src/translator/core/textarea.ts
4786
4790
  var import_compiler25 = require("@marko/compiler");
4791
+ function preAnalyze(tag) {
4792
+ if (tag.node.body.body.length) {
4793
+ const parts = [];
4794
+ for (const child of tag.node.body.body) {
4795
+ if (child.type === "MarkoText" || child.type === "MarkoPlaceholder" && child.escape) {
4796
+ parts.push(child.value);
4797
+ } else {
4798
+ throw tag.hub.file.hub.buildError(
4799
+ child,
4800
+ "Unexpected content in textarea, only text and placeholders are supported.",
4801
+ SyntaxError
4802
+ );
4803
+ }
4804
+ }
4805
+ const textValue = normalizeStringExpression(parts);
4806
+ if (textValue) {
4807
+ tag.node.attributes.push(import_compiler25.types.markoAttribute("value", textValue));
4808
+ }
4809
+ tag.node.body.body = [];
4810
+ }
4811
+ }
4787
4812
 
4788
4813
  // src/translator/util/with-previous-location.ts
4789
4814
  function withPreviousLocation(newNode, originalNode) {
@@ -4796,7 +4821,7 @@ function withPreviousLocation(newNode, originalNode) {
4796
4821
  // src/translator/visitors/program/pre-analyze.ts
4797
4822
  var TAG_NAME_IDENTIFIER_REG = /^[A-Z][a-zA-Z0-9_$]*$/;
4798
4823
  var BINDING_CHANGE_HANDLER = /* @__PURE__ */ new WeakMap();
4799
- function preAnalyze(program) {
4824
+ function preAnalyze2(program) {
4800
4825
  const state = { crawl: false };
4801
4826
  normalizeBody(state, program.get("body"));
4802
4827
  if (state.crawl) {
@@ -4838,12 +4863,18 @@ function normalizeTag(state, tag) {
4838
4863
  const tagName = name2.value;
4839
4864
  if (tag.scope.getBinding(tagName) && TAG_NAME_IDENTIFIER_REG.test(tagName)) {
4840
4865
  state.crawl = true;
4841
- node.name = withPreviousLocation(import_compiler25.types.identifier(tagName), name2);
4866
+ node.name = withPreviousLocation(import_compiler26.types.identifier(tagName), name2);
4867
+ } else {
4868
+ switch (tagName) {
4869
+ case "textarea":
4870
+ preAnalyze(tag);
4871
+ break;
4872
+ }
4842
4873
  }
4843
4874
  }
4844
4875
  for (let i = 0; i < attributes.length; i++) {
4845
4876
  const attr = attributes[i];
4846
- if (import_compiler25.types.isMarkoAttribute(attr) && attr.bound) {
4877
+ if (import_compiler26.types.isMarkoAttribute(attr) && attr.bound) {
4847
4878
  state.crawl = true;
4848
4879
  attr.bound = false;
4849
4880
  attributes.splice(++i, 0, getChangeHandler(tag, attr));
@@ -4853,10 +4884,10 @@ function normalizeTag(state, tag) {
4853
4884
  function getChangeHandler(tag, attr) {
4854
4885
  const attrName = attr.name;
4855
4886
  const changeAttrName = attrName + "Change";
4856
- if (import_compiler25.types.isIdentifier(attr.value)) {
4887
+ if (import_compiler26.types.isIdentifier(attr.value)) {
4857
4888
  const binding = tag.scope.getBinding(attr.value.name);
4858
4889
  if (!binding)
4859
- return import_compiler25.types.markoAttribute(
4890
+ return import_compiler26.types.markoAttribute(
4860
4891
  changeAttrName,
4861
4892
  buildChangeHandlerFunction(attr.value)
4862
4893
  );
@@ -4869,7 +4900,7 @@ function getChangeHandler(tag, attr) {
4869
4900
  if (!changeAttrExpr) {
4870
4901
  throw tag.hub.buildError(attr.value, "Unable to bind to value.");
4871
4902
  }
4872
- const changeHandlerAttr = import_compiler25.types.markoAttribute(
4903
+ const changeHandlerAttr = import_compiler26.types.markoAttribute(
4873
4904
  changeAttrName,
4874
4905
  changeAttrExpr
4875
4906
  );
@@ -4877,10 +4908,10 @@ function getChangeHandler(tag, attr) {
4877
4908
  return changeHandlerAttr;
4878
4909
  }
4879
4910
  if (existingChangedAttr.type === "Identifier") {
4880
- return import_compiler25.types.markoAttribute(
4911
+ return import_compiler26.types.markoAttribute(
4881
4912
  changeAttrName,
4882
4913
  withPreviousLocation(
4883
- import_compiler25.types.identifier(existingChangedAttr.name),
4914
+ import_compiler26.types.identifier(existingChangedAttr.name),
4884
4915
  attr.value
4885
4916
  )
4886
4917
  );
@@ -4890,16 +4921,16 @@ function getChangeHandler(tag, attr) {
4890
4921
  throw tag.hub.buildError(attr.value, "Unable to bind to value.");
4891
4922
  }
4892
4923
  const changeHandlerId = generateUid(changeAttrName);
4893
- const changeHandlerConst = import_compiler25.types.markoTag(
4894
- import_compiler25.types.stringLiteral("const"),
4895
- [import_compiler25.types.markoAttribute("value", existingChangedAttr.value, null, null, true)],
4896
- import_compiler25.types.markoTagBody([]),
4924
+ const changeHandlerConst = import_compiler26.types.markoTag(
4925
+ import_compiler26.types.stringLiteral("const"),
4926
+ [import_compiler26.types.markoAttribute("value", existingChangedAttr.value, null, null, true)],
4927
+ import_compiler26.types.markoTagBody([]),
4897
4928
  null,
4898
- import_compiler25.types.identifier(changeHandlerId)
4929
+ import_compiler26.types.identifier(changeHandlerId)
4899
4930
  );
4900
4931
  BINDING_CHANGE_HANDLER.set(
4901
4932
  binding.identifier,
4902
- existingChangedAttr.value = import_compiler25.types.identifier(changeHandlerId)
4933
+ existingChangedAttr.value = import_compiler26.types.identifier(changeHandlerId)
4903
4934
  );
4904
4935
  if (markoRoot.isMarkoTag()) {
4905
4936
  markoRoot.insertAfter(changeHandlerConst);
@@ -4907,23 +4938,23 @@ function getChangeHandler(tag, attr) {
4907
4938
  markoRoot.unshiftContainer("body", changeHandlerConst);
4908
4939
  }
4909
4940
  markoRoot.scope.crawl();
4910
- return import_compiler25.types.markoAttribute(
4941
+ return import_compiler26.types.markoAttribute(
4911
4942
  changeAttrName,
4912
- withPreviousLocation(import_compiler25.types.identifier(changeHandlerId), attr.value)
4943
+ withPreviousLocation(import_compiler26.types.identifier(changeHandlerId), attr.value)
4913
4944
  );
4914
- } else if (import_compiler25.types.isMemberExpression(attr.value) || import_compiler25.types.isOptionalMemberExpression(attr.value)) {
4945
+ } else if (import_compiler26.types.isMemberExpression(attr.value) || import_compiler26.types.isOptionalMemberExpression(attr.value)) {
4915
4946
  const prop = attr.value.property;
4916
- if (!import_compiler25.types.isPrivateName(attr.value.property)) {
4917
- const memberObj = import_compiler25.types.cloneNode(attr.value.object);
4918
- const memberProp = prop.type === "Identifier" ? withPreviousLocation(import_compiler25.types.identifier(prop.name + "Change"), prop) : import_compiler25.types.binaryExpression(
4947
+ if (!import_compiler26.types.isPrivateName(attr.value.property)) {
4948
+ const memberObj = import_compiler26.types.cloneNode(attr.value.object);
4949
+ const memberProp = prop.type === "Identifier" ? withPreviousLocation(import_compiler26.types.identifier(prop.name + "Change"), prop) : import_compiler26.types.binaryExpression(
4919
4950
  "+",
4920
- import_compiler25.types.cloneNode(prop),
4921
- import_compiler25.types.stringLiteral("Change")
4951
+ import_compiler26.types.cloneNode(prop),
4952
+ import_compiler26.types.stringLiteral("Change")
4922
4953
  );
4923
4954
  const computed = memberProp.type !== "Identifier";
4924
- return import_compiler25.types.markoAttribute(
4955
+ return import_compiler26.types.markoAttribute(
4925
4956
  changeAttrName,
4926
- attr.value.optional ? import_compiler25.types.optionalMemberExpression(memberObj, memberProp, computed, true) : import_compiler25.types.memberExpression(memberObj, memberProp, computed)
4957
+ attr.value.optional ? import_compiler26.types.optionalMemberExpression(memberObj, memberProp, computed, true) : import_compiler26.types.memberExpression(memberObj, memberProp, computed)
4927
4958
  );
4928
4959
  }
4929
4960
  }
@@ -4934,14 +4965,14 @@ function getChangeHandler(tag, attr) {
4934
4965
  }
4935
4966
  function buildChangeHandlerFunction(id) {
4936
4967
  const newId = "_new_" + id.name;
4937
- return import_compiler25.types.arrowFunctionExpression(
4938
- [withPreviousLocation(import_compiler25.types.identifier(newId), id)],
4939
- import_compiler25.types.blockStatement([
4940
- import_compiler25.types.expressionStatement(
4941
- import_compiler25.types.assignmentExpression(
4968
+ return import_compiler26.types.arrowFunctionExpression(
4969
+ [withPreviousLocation(import_compiler26.types.identifier(newId), id)],
4970
+ import_compiler26.types.blockStatement([
4971
+ import_compiler26.types.expressionStatement(
4972
+ import_compiler26.types.assignmentExpression(
4942
4973
  "=",
4943
- withPreviousLocation(import_compiler25.types.identifier(id.name), id),
4944
- withPreviousLocation(import_compiler25.types.identifier(newId), id)
4974
+ withPreviousLocation(import_compiler26.types.identifier(id.name), id),
4975
+ withPreviousLocation(import_compiler26.types.identifier(newId), id)
4945
4976
  )
4946
4977
  )
4947
4978
  ])
@@ -4954,11 +4985,11 @@ function getChangeHandlerFromObjectPattern(parent) {
4954
4985
  changeKey = generateUidIdentifier("dynamicChange");
4955
4986
  pattern.pushContainer(
4956
4987
  "properties",
4957
- import_compiler25.types.objectProperty(
4958
- import_compiler25.types.binaryExpression(
4988
+ import_compiler26.types.objectProperty(
4989
+ import_compiler26.types.binaryExpression(
4959
4990
  "+",
4960
4991
  parent.get("key").node,
4961
- import_compiler25.types.stringLiteral("Change")
4992
+ import_compiler26.types.stringLiteral("Change")
4962
4993
  ),
4963
4994
  changeKey,
4964
4995
  true
@@ -4980,8 +5011,8 @@ function getChangeHandlerFromObjectPattern(parent) {
4980
5011
  if (!changeKey) {
4981
5012
  pattern.unshiftContainer(
4982
5013
  "properties",
4983
- import_compiler25.types.objectProperty(
4984
- import_compiler25.types.stringLiteral(searchKey),
5014
+ import_compiler26.types.objectProperty(
5015
+ import_compiler26.types.stringLiteral(searchKey),
4985
5016
  changeKey = generateUidIdentifier(searchKey)
4986
5017
  )
4987
5018
  );
@@ -5011,7 +5042,7 @@ function getAssignmentInsertions(node, insertions) {
5011
5042
  getLiteralName(left) || getLiteralName(prop.key) || "pattern"
5012
5043
  );
5013
5044
  prop.shorthand = false;
5014
- prop.value = import_compiler25.types.identifier(sourceName);
5045
+ prop.value = import_compiler26.types.identifier(sourceName);
5015
5046
  (insertions ||= []).push(
5016
5047
  toConstTag(left, toFallbackExpr(sourceName, right))
5017
5048
  );
@@ -5029,7 +5060,7 @@ function getAssignmentInsertions(node, insertions) {
5029
5060
  if (el.type === "AssignmentPattern") {
5030
5061
  const { left, right } = el;
5031
5062
  const sourceName = generateUid(getLiteralName(left) || "pattern");
5032
- node.elements[i] = import_compiler25.types.identifier(sourceName);
5063
+ node.elements[i] = import_compiler26.types.identifier(sourceName);
5033
5064
  (insertions ||= []).push(
5034
5065
  toConstTag(left, toFallbackExpr(sourceName, right))
5035
5066
  );
@@ -5044,23 +5075,23 @@ function getAssignmentInsertions(node, insertions) {
5044
5075
  return insertions;
5045
5076
  }
5046
5077
  function toFallbackExpr(id, fallback) {
5047
- return import_compiler25.types.conditionalExpression(
5048
- import_compiler25.types.binaryExpression("!==", buildUndefined(), import_compiler25.types.identifier(id)),
5049
- import_compiler25.types.identifier(id),
5078
+ return import_compiler26.types.conditionalExpression(
5079
+ import_compiler26.types.binaryExpression("!==", buildUndefined(), import_compiler26.types.identifier(id)),
5080
+ import_compiler26.types.identifier(id),
5050
5081
  fallback
5051
5082
  );
5052
5083
  }
5053
5084
  function toConstTag(id, expr) {
5054
- return import_compiler25.types.markoTag(
5055
- import_compiler25.types.stringLiteral("const"),
5056
- [import_compiler25.types.markoAttribute("value", expr, null, null, true)],
5057
- import_compiler25.types.markoTagBody(),
5085
+ return import_compiler26.types.markoTag(
5086
+ import_compiler26.types.stringLiteral("const"),
5087
+ [import_compiler26.types.markoAttribute("value", expr, null, null, true)],
5088
+ import_compiler26.types.markoTagBody(),
5058
5089
  null,
5059
5090
  id
5060
5091
  );
5061
5092
  }
5062
5093
  function buildUndefined() {
5063
- return import_compiler25.types.unaryExpression("void", import_compiler25.types.numericLiteral(0));
5094
+ return import_compiler26.types.unaryExpression("void", import_compiler26.types.numericLiteral(0));
5064
5095
  }
5065
5096
 
5066
5097
  // src/translator/visitors/program/index.ts
@@ -5072,14 +5103,14 @@ function isScopeIdentifier(node) {
5072
5103
  var program_default = {
5073
5104
  migrate: {
5074
5105
  enter(program) {
5075
- program.node.params = [import_compiler26.types.identifier("input")];
5106
+ program.node.params = [import_compiler27.types.identifier("input")];
5076
5107
  },
5077
5108
  exit(program) {
5078
5109
  program.scope.crawl();
5079
5110
  }
5080
5111
  },
5081
5112
  transform: {
5082
- exit: preAnalyze
5113
+ exit: preAnalyze2
5083
5114
  },
5084
5115
  analyze: {
5085
5116
  enter(program) {
@@ -5161,7 +5192,7 @@ var program_default = {
5161
5192
  body.push(child);
5162
5193
  }
5163
5194
  }
5164
- body[0] ??= import_compiler26.types.importDeclaration([], import_compiler26.types.stringLiteral(compatFile));
5195
+ body[0] ??= import_compiler27.types.importDeclaration([], import_compiler27.types.stringLiteral(compatFile));
5165
5196
  program.node.body = body;
5166
5197
  }
5167
5198
  }
@@ -5175,7 +5206,7 @@ function resolveRelativeToEntry(entryFile, file, req) {
5175
5206
  }
5176
5207
 
5177
5208
  // src/translator/util/nested-attribute-tags.ts
5178
- var import_compiler27 = require("@marko/compiler");
5209
+ var import_compiler28 = require("@marko/compiler");
5179
5210
  var import_babel_utils18 = require("@marko/compiler/babel-utils");
5180
5211
  var attrTagToIdentifierLookup = /* @__PURE__ */ new WeakMap();
5181
5212
  function getAttrTagIdentifier(meta) {
@@ -5184,7 +5215,7 @@ function getAttrTagIdentifier(meta) {
5184
5215
  name2 = generateUid(meta.name);
5185
5216
  attrTagToIdentifierLookup.set(meta, name2);
5186
5217
  }
5187
- return import_compiler27.types.identifier(name2);
5218
+ return import_compiler28.types.identifier(name2);
5188
5219
  }
5189
5220
  function analyzeAttributeTags(tag) {
5190
5221
  if (tag.node.extra?.attributeTags) return tag.node.extra.attributeTags;
@@ -5297,7 +5328,7 @@ function getConditionRoot(tag) {
5297
5328
  }
5298
5329
 
5299
5330
  // src/translator/util/set-tag-sections-downstream.ts
5300
- var import_compiler28 = require("@marko/compiler");
5331
+ var import_compiler29 = require("@marko/compiler");
5301
5332
  var import_babel_utils19 = require("@marko/compiler/babel-utils");
5302
5333
  var [getTagDownstreams] = createSectionState(
5303
5334
  "tag-downstreams",
@@ -5344,23 +5375,82 @@ function crawlSectionsAndSetBinding(tag, binding, tree, skip2) {
5344
5375
  }
5345
5376
 
5346
5377
  // src/translator/util/translate-attrs.ts
5347
- var import_compiler33 = require("@marko/compiler");
5348
- var import_babel_utils23 = require("@marko/compiler/babel-utils");
5378
+ var import_compiler36 = require("@marko/compiler");
5379
+ var import_babel_utils24 = require("@marko/compiler/babel-utils");
5349
5380
 
5350
5381
  // src/translator/core/for.ts
5351
- var import_compiler32 = require("@marko/compiler");
5352
- var import_babel_utils22 = require("@marko/compiler/babel-utils");
5382
+ var import_compiler35 = require("@marko/compiler");
5383
+ var import_babel_utils23 = require("@marko/compiler/babel-utils");
5353
5384
 
5354
5385
  // src/translator/util/is-only-child-in-parent.ts
5355
- var import_compiler31 = require("@marko/compiler");
5356
- var import_babel_utils21 = require("@marko/compiler/babel-utils");
5386
+ var import_compiler34 = require("@marko/compiler");
5387
+ var import_babel_utils22 = require("@marko/compiler/babel-utils");
5357
5388
 
5358
5389
  // src/translator/visitors/tag/native-tag.ts
5390
+ var import_compiler33 = require("@marko/compiler");
5391
+ var import_babel_utils21 = require("@marko/compiler/babel-utils");
5392
+
5393
+ // src/translator/util/body-to-text-literal.ts
5359
5394
  var import_compiler30 = require("@marko/compiler");
5395
+ function bodyToTextLiteral(body) {
5396
+ const templateQuasis = [];
5397
+ const templateExpressions = [];
5398
+ let currentQuasi = "";
5399
+ let placeholderExtra;
5400
+ for (const child of body.body) {
5401
+ if (import_compiler30.types.isMarkoText(child)) {
5402
+ currentQuasi += child.value;
5403
+ } else if (import_compiler30.types.isMarkoPlaceholder(child)) {
5404
+ placeholderExtra ||= child.value.extra;
5405
+ templateQuasis.push(templateElement(currentQuasi, false));
5406
+ templateExpressions.push(callRuntime("_to_text", child.value));
5407
+ currentQuasi = "";
5408
+ }
5409
+ }
5410
+ if (templateExpressions.length) {
5411
+ templateQuasis.push(templateElement(currentQuasi, true));
5412
+ const literal = import_compiler30.types.templateLiteral(templateQuasis, templateExpressions);
5413
+ literal.extra = placeholderExtra;
5414
+ return literal;
5415
+ }
5416
+ return import_compiler30.types.stringLiteral(currentQuasi);
5417
+ }
5418
+ function templateElement(value, tail) {
5419
+ return import_compiler30.types.templateElement(
5420
+ {
5421
+ raw: value.replace(/`/g, "\\`"),
5422
+ cooked: value
5423
+ },
5424
+ tail
5425
+ );
5426
+ }
5427
+
5428
+ // src/translator/util/is-non-html-text.ts
5429
+ var import_compiler31 = require("@marko/compiler");
5360
5430
  var import_babel_utils20 = require("@marko/compiler/babel-utils");
5431
+ function isNonHTMLText(placeholder) {
5432
+ const parentTag = placeholder.parentPath.isMarkoTagBody() && placeholder.parentPath.parentPath;
5433
+ if (parentTag) {
5434
+ if (isCoreTag(parentTag)) {
5435
+ switch (parentTag.node.name.value) {
5436
+ case "html-comment":
5437
+ case "html-script":
5438
+ case "html-style":
5439
+ return true;
5440
+ }
5441
+ } else if (isTextOnlyNativeTag(parentTag)) {
5442
+ return true;
5443
+ }
5444
+ }
5445
+ return false;
5446
+ }
5447
+ function isTextOnlyNativeTag(tag) {
5448
+ const def = (0, import_babel_utils20.getTagDef)(tag);
5449
+ return !!(def && def.html && (def.name === "title" || def.parseOptions?.text));
5450
+ }
5361
5451
 
5362
5452
  // src/translator/util/translate-var.ts
5363
- var import_compiler29 = require("@marko/compiler");
5453
+ var import_compiler32 = require("@marko/compiler");
5364
5454
  function translateVar(tag, initialValue, kind = "const") {
5365
5455
  const {
5366
5456
  node: { var: tagVar }
@@ -5378,15 +5468,15 @@ function translateVar(tag, initialValue, kind = "const") {
5378
5468
  if (changeBinding && changeName !== changeBinding.name) {
5379
5469
  getDestructurePattern(id)?.pushContainer(
5380
5470
  "properties",
5381
- import_compiler29.types.objectProperty(
5382
- import_compiler29.types.identifier(changeName),
5383
- import_compiler29.types.identifier(changeBinding.name)
5471
+ import_compiler32.types.objectProperty(
5472
+ import_compiler32.types.identifier(changeName),
5473
+ import_compiler32.types.identifier(changeBinding.name)
5384
5474
  )
5385
5475
  );
5386
5476
  }
5387
5477
  });
5388
5478
  tag.insertBefore(
5389
- import_compiler29.types.variableDeclaration(kind, [import_compiler29.types.variableDeclarator(tagVar, initialValue)])
5479
+ import_compiler32.types.variableDeclaration(kind, [import_compiler32.types.variableDeclarator(tagVar, initialValue)])
5390
5480
  );
5391
5481
  }
5392
5482
  function translateDomVar(tag, binding) {
@@ -5396,13 +5486,13 @@ function translateDomVar(tag, binding) {
5396
5486
  if (registerId) {
5397
5487
  tag.parentPath.unshiftContainer(
5398
5488
  "body",
5399
- import_compiler29.types.variableDeclaration("const", [
5400
- import_compiler29.types.variableDeclarator(
5489
+ import_compiler32.types.variableDeclaration("const", [
5490
+ import_compiler32.types.variableDeclarator(
5401
5491
  tag.node.var,
5402
5492
  callRuntime(
5403
5493
  "_el",
5404
5494
  getScopeIdIdentifier(tagSection),
5405
- import_compiler29.types.stringLiteral(registerId)
5495
+ import_compiler32.types.stringLiteral(registerId)
5406
5496
  )
5407
5497
  )
5408
5498
  ])
@@ -5428,65 +5518,83 @@ var htmlSelectArgs = /* @__PURE__ */ new WeakMap();
5428
5518
  var native_tag_default = {
5429
5519
  analyze: {
5430
5520
  enter(tag) {
5431
- (0, import_babel_utils20.assertNoArgs)(tag);
5432
- (0, import_babel_utils20.assertNoParams)(tag);
5433
- (0, import_babel_utils20.assertNoAttributeTags)(tag);
5521
+ (0, import_babel_utils21.assertNoArgs)(tag);
5522
+ (0, import_babel_utils21.assertNoParams)(tag);
5523
+ (0, import_babel_utils21.assertNoAttributeTags)(tag);
5434
5524
  const { node } = tag;
5435
- if (node.var && !import_compiler30.types.isIdentifier(node.var)) {
5525
+ if (node.var && !import_compiler33.types.isIdentifier(node.var)) {
5436
5526
  throw tag.get("var").buildCodeFrameError(
5437
5527
  "Tag variables on [native tags](https://markojs.com/docs/reference/native-tag) cannot be destructured."
5438
5528
  );
5439
5529
  }
5440
- const tagName = getTagName(tag);
5530
+ const tagName = getCanonicalTagName(tag);
5531
+ const isTextOnly = isTextOnlyNativeTag(tag);
5441
5532
  const seen = {};
5442
5533
  const { attributes } = tag.node;
5534
+ let injectNonce = isInjectNonceTag(tagName);
5443
5535
  let hasDynamicAttributes = false;
5444
5536
  let hasEventHandlers = false;
5445
5537
  let relatedControllable;
5446
5538
  let spreadReferenceNodes;
5447
- let attrExprExtras;
5539
+ let exprExtras;
5448
5540
  for (let i = attributes.length; i--; ) {
5449
5541
  const attr = attributes[i];
5450
5542
  const valueExtra = attr.value.extra ??= {};
5451
- if (import_compiler30.types.isMarkoAttribute(attr)) {
5543
+ if (import_compiler33.types.isMarkoAttribute(attr)) {
5452
5544
  if (seen[attr.name]) {
5453
5545
  dropReferences(attr.value);
5454
5546
  continue;
5455
5547
  }
5456
5548
  seen[attr.name] = attr;
5549
+ if (injectNonce && attr.name === "nonce") {
5550
+ injectNonce = false;
5551
+ }
5457
5552
  if (isEventHandler(attr.name) || isNativeTagChangeHandler(attr.name)) {
5458
5553
  valueExtra.isEffect = true;
5459
5554
  hasEventHandlers = true;
5460
5555
  } else if (!evaluate(attr.value).confident) {
5461
5556
  hasDynamicAttributes = true;
5462
5557
  }
5463
- } else if (import_compiler30.types.isMarkoSpreadAttribute(attr)) {
5558
+ } else if (import_compiler33.types.isMarkoSpreadAttribute(attr)) {
5464
5559
  valueExtra.isEffect = true;
5465
5560
  hasEventHandlers = true;
5466
5561
  hasDynamicAttributes = true;
5467
5562
  }
5468
5563
  if (spreadReferenceNodes) {
5469
5564
  spreadReferenceNodes.push(attr.value);
5470
- } else if (import_compiler30.types.isMarkoSpreadAttribute(attr)) {
5565
+ } else if (import_compiler33.types.isMarkoSpreadAttribute(attr)) {
5471
5566
  spreadReferenceNodes = [attr.value];
5472
5567
  relatedControllable = getRelatedControllable(tagName, seen);
5473
5568
  } else {
5474
- attrExprExtras = push(attrExprExtras, valueExtra);
5569
+ exprExtras = push(exprExtras, valueExtra);
5475
5570
  }
5476
5571
  }
5477
5572
  assertExclusiveAttrs(seen, (msg) => {
5478
5573
  throw tag.get("name").buildCodeFrameError(msg);
5479
5574
  });
5480
- if (node.var || hasEventHandlers || hasDynamicAttributes || getRelatedControllable(tagName, seen)?.special) {
5575
+ let textPlaceholders;
5576
+ if (isTextOnly) {
5577
+ for (const child of tag.node.body.body) {
5578
+ if (import_compiler33.types.isMarkoPlaceholder(child)) {
5579
+ (textPlaceholders ||= []).push(child.value);
5580
+ } else if (!import_compiler33.types.isMarkoText(child)) {
5581
+ throw tag.hub.buildError(
5582
+ child,
5583
+ `Only text is allowed inside a \`<${tagName}>\`.`
5584
+ );
5585
+ }
5586
+ }
5587
+ }
5588
+ if (node.var || hasDynamicAttributes || hasEventHandlers || textPlaceholders || injectNonce || getRelatedControllable(tagName, seen)?.special) {
5481
5589
  const tagExtra = node.extra ??= {};
5482
5590
  const tagSection = getOrCreateSection(tag);
5483
5591
  const nodeBinding = tagExtra[kNativeTagBinding] = createBinding(
5484
- "#" + (node.name.type === "StringLiteral" ? node.name.value : import_compiler30.types.toIdentifier(tag.get("name"))),
5592
+ "#" + getCanonicalTagName(tag),
5485
5593
  0 /* dom */,
5486
5594
  tagSection
5487
5595
  );
5488
5596
  if (hasEventHandlers) {
5489
- (0, import_babel_utils20.getProgram)().node.extra.isInteractive = true;
5597
+ (0, import_babel_utils21.getProgram)().node.extra.isInteractive = true;
5490
5598
  }
5491
5599
  if (spreadReferenceNodes) {
5492
5600
  if (relatedControllable && !relatedControllable.attrs.every(Boolean)) {
@@ -5508,38 +5616,50 @@ var native_tag_default = {
5508
5616
  relatedControllable.attrs.map((it) => it?.value)
5509
5617
  );
5510
5618
  }
5619
+ if (textPlaceholders) {
5620
+ exprExtras = push(
5621
+ exprExtras,
5622
+ textPlaceholders.length === 1 ? textPlaceholders[0].extra ??= {} : mergeReferences(
5623
+ tagSection,
5624
+ textPlaceholders[0],
5625
+ textPlaceholders.slice(1)
5626
+ )
5627
+ );
5628
+ }
5511
5629
  addSerializeExpr(
5512
5630
  tagSection,
5513
5631
  !!(node.var || hasEventHandlers),
5514
5632
  nodeBinding
5515
5633
  );
5516
5634
  trackDomVarReferences(tag, nodeBinding);
5517
- addSerializeExpr(
5518
- tagSection,
5519
- push(attrExprExtras, tagExtra),
5520
- nodeBinding
5521
- );
5635
+ addSerializeExpr(tagSection, push(exprExtras, tagExtra), nodeBinding);
5522
5636
  }
5523
5637
  }
5524
5638
  },
5525
5639
  translate: translateByTarget({
5526
5640
  html: {
5527
5641
  enter(tag) {
5528
- const tagName = getTagName(tag);
5642
+ const tagName = getCanonicalTagName(tag);
5529
5643
  const tagExtra = tag.node.extra;
5530
5644
  const nodeBinding = tagExtra[kNativeTagBinding];
5531
- const tagDef = (0, import_babel_utils20.getTagDef)(tag);
5645
+ const tagDef = (0, import_babel_utils21.getTagDef)(tag);
5532
5646
  const write = writeTo(tag);
5533
5647
  const tagSection = getSection(tag);
5534
- if (tagExtra.tagNameNullable) {
5535
- flushBefore(tag);
5536
- }
5537
5648
  translateDomVar(tag, nodeBinding);
5538
5649
  const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
5539
- write`<${tag.node.name}`;
5650
+ write`<${tagName}`;
5540
5651
  const usedAttrs = getUsedAttrs(tagName, tag.node);
5541
- const { staticAttrs, staticControllable, skipExpression } = usedAttrs;
5652
+ const {
5653
+ staticAttrs,
5654
+ staticControllable,
5655
+ staticContentAttr,
5656
+ skipExpression,
5657
+ injectNonce
5658
+ } = usedAttrs;
5542
5659
  let { spreadExpression } = usedAttrs;
5660
+ if (injectNonce) {
5661
+ write`${callRuntime("_attr_nonce")}`;
5662
+ }
5543
5663
  if (staticControllable) {
5544
5664
  if (tagName !== "select" && tagName !== "textarea") {
5545
5665
  write`${callRuntime(
@@ -5563,18 +5683,18 @@ var native_tag_default = {
5563
5683
  } else if (spreadExpression) {
5564
5684
  const spreadIdentifier = generateUidIdentifier("select_input");
5565
5685
  tag.insertBefore(
5566
- import_compiler30.types.variableDeclaration("const", [
5567
- import_compiler30.types.variableDeclarator(spreadIdentifier, spreadExpression)
5686
+ import_compiler33.types.variableDeclaration("const", [
5687
+ import_compiler33.types.variableDeclarator(spreadIdentifier, spreadExpression)
5568
5688
  ])
5569
5689
  );
5570
5690
  htmlSelectArgs.set(tag.node, {
5571
- value: import_compiler30.types.memberExpression(
5691
+ value: import_compiler33.types.memberExpression(
5572
5692
  spreadIdentifier,
5573
- import_compiler30.types.identifier("value")
5693
+ import_compiler33.types.identifier("value")
5574
5694
  ),
5575
- valueChange: import_compiler30.types.memberExpression(
5695
+ valueChange: import_compiler33.types.memberExpression(
5576
5696
  spreadIdentifier,
5577
- import_compiler30.types.identifier("valueChange")
5697
+ import_compiler33.types.identifier("valueChange")
5578
5698
  )
5579
5699
  });
5580
5700
  spreadExpression = spreadIdentifier;
@@ -5588,14 +5708,14 @@ var native_tag_default = {
5588
5708
  } else if (spreadExpression) {
5589
5709
  const spreadIdentifier = generateUidIdentifier("textarea_input");
5590
5710
  tag.insertBefore(
5591
- import_compiler30.types.variableDeclaration("const", [
5592
- import_compiler30.types.variableDeclarator(spreadIdentifier, spreadExpression)
5711
+ import_compiler33.types.variableDeclaration("const", [
5712
+ import_compiler33.types.variableDeclarator(spreadIdentifier, spreadExpression)
5593
5713
  ])
5594
5714
  );
5595
- value = import_compiler30.types.memberExpression(spreadIdentifier, import_compiler30.types.identifier("value"));
5596
- valueChange = import_compiler30.types.memberExpression(
5715
+ value = import_compiler33.types.memberExpression(spreadIdentifier, import_compiler33.types.identifier("value"));
5716
+ valueChange = import_compiler33.types.memberExpression(
5597
5717
  spreadIdentifier,
5598
- import_compiler30.types.identifier("valueChange")
5718
+ import_compiler33.types.identifier("valueChange")
5599
5719
  );
5600
5720
  spreadExpression = spreadIdentifier;
5601
5721
  }
@@ -5608,7 +5728,7 @@ var native_tag_default = {
5608
5728
  valueChange
5609
5729
  );
5610
5730
  } else if (value) {
5611
- writeAtStartOfBody = callRuntime("_to_text", value);
5731
+ writeAtStartOfBody = callRuntime("_escape_text", value);
5612
5732
  }
5613
5733
  }
5614
5734
  for (const attr of staticAttrs) {
@@ -5636,20 +5756,34 @@ var native_tag_default = {
5636
5756
  } else if (isEventHandler(name2)) {
5637
5757
  addHTMLEffectCall(tagSection, valueReferences);
5638
5758
  } else {
5639
- write`${callRuntime("_attr", import_compiler30.types.stringLiteral(name2), value)}`;
5759
+ write`${callRuntime("_attr", import_compiler33.types.stringLiteral(name2), value)}`;
5640
5760
  }
5641
5761
  break;
5642
5762
  }
5643
5763
  }
5644
5764
  const isOpenOnly = !!(tagDef && tagDef.parseOptions?.openTagOnly);
5765
+ const isTextOnly = isTextOnlyNativeTag(tag);
5645
5766
  const hasChildren = !!tag.node.body.body.length;
5646
5767
  if (spreadExpression) {
5647
5768
  addHTMLEffectCall(tagSection, tagExtra.referencedBindings);
5648
- if (isOpenOnly || hasChildren || usedAttrs.staticContentAttr) {
5769
+ if (isTextOnly || isOpenOnly || hasChildren || staticContentAttr) {
5649
5770
  if (skipExpression) {
5650
- write`${callRuntime("_attrs_partial", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(tagSection), tag.node.name)}`;
5771
+ write`${callRuntime(
5772
+ "_attrs_partial",
5773
+ spreadExpression,
5774
+ skipExpression,
5775
+ visitAccessor,
5776
+ getScopeIdIdentifier(tagSection),
5777
+ import_compiler33.types.stringLiteral(tagName)
5778
+ )}`;
5651
5779
  } else {
5652
- write`${callRuntime("_attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(tagSection), tag.node.name)}`;
5780
+ write`${callRuntime(
5781
+ "_attrs",
5782
+ spreadExpression,
5783
+ visitAccessor,
5784
+ getScopeIdIdentifier(tagSection),
5785
+ import_compiler33.types.stringLiteral(tagName)
5786
+ )}`;
5653
5787
  }
5654
5788
  }
5655
5789
  }
@@ -5663,62 +5797,57 @@ var native_tag_default = {
5663
5797
  write`>`;
5664
5798
  break;
5665
5799
  }
5666
- } else {
5667
- if (usedAttrs.staticContentAttr) {
5668
- write`>`;
5669
- tagExtra[kTagContentAttr] = true;
5670
- tag.node.body.body = [
5671
- import_compiler30.types.expressionStatement(
5672
- callRuntime(
5673
- "_attr_content",
5674
- visitAccessor,
5675
- getScopeIdIdentifier(tagSection),
5676
- usedAttrs.staticContentAttr.value,
5677
- getSerializeGuard(
5678
- tagSection,
5679
- nodeBinding && getSerializeReason(tagSection, nodeBinding),
5680
- true
5681
- )
5800
+ } else if (isTextOnly) {
5801
+ write`>`;
5802
+ } else if (staticContentAttr) {
5803
+ write`>`;
5804
+ tagExtra[kTagContentAttr] = true;
5805
+ tag.node.body.body = [
5806
+ import_compiler33.types.expressionStatement(
5807
+ callRuntime(
5808
+ "_attr_content",
5809
+ visitAccessor,
5810
+ getScopeIdIdentifier(tagSection),
5811
+ staticContentAttr.value,
5812
+ getSerializeGuard(
5813
+ tagSection,
5814
+ nodeBinding && getSerializeReason(tagSection, nodeBinding),
5815
+ true
5682
5816
  )
5683
5817
  )
5684
- ];
5685
- } else if (spreadExpression && !hasChildren) {
5686
- const serializeReason = getSerializeGuard(
5687
- tagSection,
5688
- nodeBinding && getSerializeReason(tagSection, nodeBinding),
5689
- true
5690
- );
5691
- tagExtra[kTagContentAttr] = true;
5692
- tag.node.body.body = [
5693
- skipExpression ? import_compiler30.types.expressionStatement(
5694
- callRuntime(
5695
- "_attrs_partial_content",
5696
- spreadExpression,
5697
- skipExpression,
5698
- visitAccessor,
5699
- getScopeIdIdentifier(tagSection),
5700
- tag.node.name,
5701
- serializeReason
5702
- )
5703
- ) : import_compiler30.types.expressionStatement(
5704
- callRuntime(
5705
- "_attrs_content",
5706
- spreadExpression,
5707
- visitAccessor,
5708
- getScopeIdIdentifier(tagSection),
5709
- tag.node.name,
5710
- serializeReason
5711
- )
5818
+ )
5819
+ ];
5820
+ } else if (spreadExpression && !hasChildren) {
5821
+ const serializeReason = getSerializeGuard(
5822
+ tagSection,
5823
+ nodeBinding && getSerializeReason(tagSection, nodeBinding),
5824
+ true
5825
+ );
5826
+ tagExtra[kTagContentAttr] = true;
5827
+ tag.node.body.body = [
5828
+ skipExpression ? import_compiler33.types.expressionStatement(
5829
+ callRuntime(
5830
+ "_attrs_partial_content",
5831
+ spreadExpression,
5832
+ skipExpression,
5833
+ visitAccessor,
5834
+ getScopeIdIdentifier(tagSection),
5835
+ import_compiler33.types.stringLiteral(tagName),
5836
+ serializeReason
5712
5837
  )
5713
- ];
5714
- } else {
5715
- write`>`;
5716
- }
5717
- }
5718
- if (tagExtra.tagNameNullable) {
5719
- tag.insertBefore(
5720
- import_compiler30.types.ifStatement(tag.node.name, consumeHTML(tag))
5721
- )[0].skip();
5838
+ ) : import_compiler33.types.expressionStatement(
5839
+ callRuntime(
5840
+ "_attrs_content",
5841
+ spreadExpression,
5842
+ visitAccessor,
5843
+ getScopeIdIdentifier(tagSection),
5844
+ import_compiler33.types.stringLiteral(tagName),
5845
+ serializeReason
5846
+ )
5847
+ )
5848
+ ];
5849
+ } else {
5850
+ write`>`;
5722
5851
  }
5723
5852
  if (writeAtStartOfBody) {
5724
5853
  write`${writeAtStartOfBody}`;
@@ -5727,50 +5856,52 @@ var native_tag_default = {
5727
5856
  exit(tag) {
5728
5857
  const tagExtra = tag.node.extra;
5729
5858
  const nodeBinding = tagExtra[kNativeTagBinding];
5730
- const openTagOnly = (0, import_babel_utils20.getTagDef)(tag)?.parseOptions?.openTagOnly;
5859
+ const isOpenOnly = (0, import_babel_utils21.getTagDef)(tag)?.parseOptions?.openTagOnly;
5860
+ const isTextOnly = isTextOnlyNativeTag(tag);
5731
5861
  const selectArgs = htmlSelectArgs.get(tag.node);
5732
- const tagName = getTagName(tag);
5862
+ const tagName = getCanonicalTagName(tag);
5733
5863
  const tagSection = getSection(tag);
5864
+ const markerSerializeReason = !tagExtra[kSkipEndTag] && nodeBinding && getSerializeReason(tagSection, nodeBinding);
5865
+ const write = writeTo(
5866
+ tag,
5867
+ !markerSerializeReason && (tagName === "html" || tagName === "body")
5868
+ );
5734
5869
  if (tagExtra[kTagContentAttr]) {
5735
5870
  flushBefore(tag);
5736
5871
  }
5737
- if (tagExtra.tagNameNullable) {
5738
- flushInto(tag);
5739
- }
5740
5872
  if (selectArgs) {
5741
5873
  if (!tagExtra[kSkipEndTag]) {
5742
- writeTo(tag)`</${tag.node.name}>`;
5874
+ write`</${tagName}>`;
5743
5875
  }
5744
5876
  flushInto(tag);
5745
5877
  tag.insertBefore(
5746
- import_compiler30.types.expressionStatement(
5878
+ import_compiler33.types.expressionStatement(
5747
5879
  callRuntime(
5748
5880
  "_attr_select_value",
5749
5881
  getScopeIdIdentifier(getSection(tag)),
5750
5882
  nodeBinding && getScopeAccessorLiteral(nodeBinding),
5751
5883
  selectArgs.value,
5752
5884
  selectArgs.valueChange,
5753
- import_compiler30.types.arrowFunctionExpression(
5885
+ import_compiler33.types.arrowFunctionExpression(
5754
5886
  [],
5755
- import_compiler30.types.blockStatement(tag.node.body.body)
5887
+ import_compiler33.types.blockStatement(tag.node.body.body)
5756
5888
  )
5757
5889
  )
5758
5890
  )
5759
5891
  );
5892
+ } else if (isTextOnly) {
5893
+ for (const child of tag.node.body.body) {
5894
+ if (import_compiler33.types.isMarkoText(child)) {
5895
+ write`${child.value}`;
5896
+ } else if (import_compiler33.types.isMarkoPlaceholder(child)) {
5897
+ write`${callRuntime(getTextOnlyEscapeHelper(tagName), child.value)}`;
5898
+ }
5899
+ }
5760
5900
  } else {
5761
5901
  tag.insertBefore(tag.node.body.body).forEach((child) => child.skip());
5762
5902
  }
5763
- const markerSerializeReason = !tagExtra[kSkipEndTag] && nodeBinding && getSerializeReason(tagSection, nodeBinding);
5764
- if (!tagExtra[kSkipEndTag] && !openTagOnly && !selectArgs) {
5765
- writeTo(
5766
- tag,
5767
- !markerSerializeReason && (tagName === "html" || tagName === "body")
5768
- )`</${tag.node.name}>`;
5769
- }
5770
- if (tagExtra.tagNameNullable) {
5771
- tag.insertBefore(
5772
- import_compiler30.types.ifStatement(tag.node.name, consumeHTML(tag))
5773
- )[0].skip();
5903
+ if (!tagExtra[kSkipEndTag] && !isOpenOnly && !selectArgs) {
5904
+ write`</${tagName}>`;
5774
5905
  }
5775
5906
  if (markerSerializeReason) {
5776
5907
  markNode(tag, nodeBinding, markerSerializeReason);
@@ -5780,22 +5911,42 @@ var native_tag_default = {
5780
5911
  },
5781
5912
  dom: {
5782
5913
  enter(tag) {
5783
- const tagName = getTagName(tag);
5914
+ const tagName = getCanonicalTagName(tag);
5784
5915
  const tagExtra = tag.node.extra;
5785
5916
  const nodeBinding = tagExtra[kNativeTagBinding];
5786
- const tagDef = (0, import_babel_utils20.getTagDef)(tag);
5917
+ const tagDef = (0, import_babel_utils21.getTagDef)(tag);
5787
5918
  const write = writeTo(tag);
5788
5919
  const tagSection = getSection(tag);
5789
5920
  const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
5790
5921
  if (nodeBinding) {
5791
5922
  visit(tag, 32 /* Get */);
5792
5923
  }
5793
- write`<${tag.node.name}`;
5794
- const usedAttrs = getUsedAttrs(tagName, tag.node);
5795
- const { staticAttrs, staticControllable, skipExpression } = usedAttrs;
5796
- const { spreadExpression } = usedAttrs;
5924
+ write`<${tagName}`;
5925
+ const {
5926
+ staticAttrs,
5927
+ staticControllable,
5928
+ staticContentAttr,
5929
+ skipExpression,
5930
+ spreadExpression,
5931
+ injectNonce
5932
+ } = getUsedAttrs(tagName, tag.node);
5797
5933
  const isOpenOnly = !!(tagDef && tagDef.parseOptions?.openTagOnly);
5934
+ const isTextOnly = isTextOnlyNativeTag(tag);
5798
5935
  const hasChildren = !!tag.node.body.body.length;
5936
+ if (injectNonce) {
5937
+ addStatement(
5938
+ "render",
5939
+ tagSection,
5940
+ void 0,
5941
+ import_compiler33.types.expressionStatement(
5942
+ callRuntime(
5943
+ "_attr_nonce",
5944
+ scopeIdentifier,
5945
+ getScopeAccessorLiteral(nodeBinding)
5946
+ )
5947
+ )
5948
+ );
5949
+ }
5799
5950
  if (staticControllable) {
5800
5951
  const { helper, attrs } = staticControllable;
5801
5952
  const firstAttr = attrs.find(Boolean);
@@ -5805,7 +5956,7 @@ var native_tag_default = {
5805
5956
  "render",
5806
5957
  tagSection,
5807
5958
  referencedBindings,
5808
- import_compiler30.types.expressionStatement(
5959
+ import_compiler33.types.expressionStatement(
5809
5960
  callRuntime(helper, scopeIdentifier, visitAccessor, ...values)
5810
5961
  )
5811
5962
  );
@@ -5814,7 +5965,7 @@ var native_tag_default = {
5814
5965
  "effect",
5815
5966
  tagSection,
5816
5967
  void 0,
5817
- import_compiler30.types.expressionStatement(
5968
+ import_compiler33.types.expressionStatement(
5818
5969
  callRuntime(`${helper}_script`, scopeIdentifier, visitAccessor)
5819
5970
  )
5820
5971
  );
@@ -5840,7 +5991,7 @@ var native_tag_default = {
5840
5991
  let stmt;
5841
5992
  trackDelimitedAttrValue(value, meta);
5842
5993
  if (meta.dynamicItems) {
5843
- stmt = import_compiler30.types.expressionStatement(
5994
+ stmt = import_compiler33.types.expressionStatement(
5844
5995
  callRuntime(helper, nodeExpr, value)
5845
5996
  );
5846
5997
  } else {
@@ -5852,11 +6003,11 @@ var native_tag_default = {
5852
6003
  if (keys.length === 1) {
5853
6004
  const [key] = keys;
5854
6005
  const value2 = meta.dynamicValues[key];
5855
- stmt = import_compiler30.types.expressionStatement(
6006
+ stmt = import_compiler33.types.expressionStatement(
5856
6007
  callRuntime(
5857
6008
  `_attr_${name2}_item`,
5858
6009
  nodeExpr,
5859
- import_compiler30.types.stringLiteral(key),
6010
+ import_compiler33.types.stringLiteral(key),
5860
6011
  value2
5861
6012
  )
5862
6013
  );
@@ -5865,14 +6016,14 @@ var native_tag_default = {
5865
6016
  for (const key of keys) {
5866
6017
  const value2 = meta.dynamicValues[key];
5867
6018
  props.push(
5868
- import_compiler30.types.objectProperty(toPropertyName(key), value2)
6019
+ import_compiler33.types.objectProperty(toPropertyName(key), value2)
5869
6020
  );
5870
6021
  }
5871
- stmt = import_compiler30.types.expressionStatement(
6022
+ stmt = import_compiler33.types.expressionStatement(
5872
6023
  callRuntime(
5873
6024
  `_attr_${name2}_items`,
5874
6025
  nodeExpr,
5875
- import_compiler30.types.objectExpression(props)
6026
+ import_compiler33.types.objectExpression(props)
5876
6027
  )
5877
6028
  );
5878
6029
  }
@@ -5892,11 +6043,11 @@ var native_tag_default = {
5892
6043
  "effect",
5893
6044
  tagSection,
5894
6045
  valueReferences,
5895
- import_compiler30.types.expressionStatement(
6046
+ import_compiler33.types.expressionStatement(
5896
6047
  callRuntime(
5897
6048
  "_on",
5898
6049
  createScopeReadExpression(nodeBinding),
5899
- import_compiler30.types.stringLiteral(getEventHandlerName(name2)),
6050
+ import_compiler33.types.stringLiteral(getEventHandlerName(name2)),
5900
6051
  value
5901
6052
  )
5902
6053
  )
@@ -5906,11 +6057,11 @@ var native_tag_default = {
5906
6057
  "render",
5907
6058
  tagSection,
5908
6059
  valueReferences,
5909
- import_compiler30.types.expressionStatement(
6060
+ import_compiler33.types.expressionStatement(
5910
6061
  callRuntime(
5911
6062
  "_attr",
5912
6063
  createScopeReadExpression(nodeBinding),
5913
- import_compiler30.types.stringLiteral(name2),
6064
+ import_compiler33.types.stringLiteral(name2),
5914
6065
  value
5915
6066
  )
5916
6067
  )
@@ -5920,13 +6071,13 @@ var native_tag_default = {
5920
6071
  }
5921
6072
  }
5922
6073
  if (spreadExpression) {
5923
- const canHaveAttrContent = !(isOpenOnly || hasChildren || usedAttrs.staticContentAttr);
6074
+ const canHaveAttrContent = !(isTextOnly || isOpenOnly || hasChildren || staticContentAttr);
5924
6075
  if (skipExpression) {
5925
6076
  addStatement(
5926
6077
  "render",
5927
6078
  tagSection,
5928
6079
  tagExtra.referencedBindings,
5929
- import_compiler30.types.expressionStatement(
6080
+ import_compiler33.types.expressionStatement(
5930
6081
  callRuntime(
5931
6082
  canHaveAttrContent ? "_attrs_partial_content" : "_attrs_partial",
5932
6083
  scopeIdentifier,
@@ -5941,7 +6092,7 @@ var native_tag_default = {
5941
6092
  "render",
5942
6093
  tagSection,
5943
6094
  tagExtra.referencedBindings,
5944
- import_compiler30.types.expressionStatement(
6095
+ import_compiler33.types.expressionStatement(
5945
6096
  callRuntime(
5946
6097
  canHaveAttrContent ? "_attrs_content" : "_attrs",
5947
6098
  scopeIdentifier,
@@ -5955,24 +6106,23 @@ var native_tag_default = {
5955
6106
  "effect",
5956
6107
  tagSection,
5957
6108
  tagExtra.referencedBindings,
5958
- import_compiler30.types.expressionStatement(
6109
+ import_compiler33.types.expressionStatement(
5959
6110
  callRuntime("_attrs_script", scopeIdentifier, visitAccessor)
5960
6111
  ),
5961
6112
  false
5962
6113
  );
5963
6114
  }
5964
- if (usedAttrs.staticContentAttr) {
5965
- const contentAttrValue = usedAttrs.staticContentAttr.value;
6115
+ if (staticContentAttr) {
5966
6116
  addStatement(
5967
6117
  "render",
5968
6118
  tagSection,
5969
- contentAttrValue.extra?.referencedBindings,
5970
- import_compiler30.types.expressionStatement(
6119
+ staticContentAttr.value.extra?.referencedBindings,
6120
+ import_compiler33.types.expressionStatement(
5971
6121
  callRuntime(
5972
6122
  "_attr_content",
5973
6123
  scopeIdentifier,
5974
6124
  visitAccessor,
5975
- contentAttrValue
6125
+ staticContentAttr.value
5976
6126
  )
5977
6127
  )
5978
6128
  );
@@ -5993,10 +6143,34 @@ var native_tag_default = {
5993
6143
  enter2(tag);
5994
6144
  },
5995
6145
  exit(tag) {
5996
- const openTagOnly = (0, import_babel_utils20.getTagDef)(tag)?.parseOptions?.openTagOnly;
5997
- tag.insertBefore(tag.node.body.body).forEach((child) => child.skip());
6146
+ const tagExtra = tag.node.extra;
6147
+ const nodeBinding = tagExtra[kNativeTagBinding];
6148
+ const openTagOnly = (0, import_babel_utils21.getTagDef)(tag)?.parseOptions?.openTagOnly;
6149
+ const tagName = getCanonicalTagName(tag);
5998
6150
  if (!openTagOnly) {
5999
- writeTo(tag)`</${tag.node.name}>`;
6151
+ const write = writeTo(tag);
6152
+ if (tagName !== "textarea" && isTextOnlyNativeTag(tag)) {
6153
+ const textLiteral = bodyToTextLiteral(tag.node.body);
6154
+ if (import_compiler33.types.isStringLiteral(textLiteral)) {
6155
+ write`${textLiteral}`;
6156
+ } else {
6157
+ addStatement(
6158
+ "render",
6159
+ getSection(tag),
6160
+ textLiteral.extra?.referencedBindings,
6161
+ import_compiler33.types.expressionStatement(
6162
+ callRuntime(
6163
+ "_text_content",
6164
+ createScopeReadExpression(nodeBinding),
6165
+ textLiteral
6166
+ )
6167
+ )
6168
+ );
6169
+ }
6170
+ } else {
6171
+ tag.insertBefore(tag.node.body.body).forEach((child) => child.skip());
6172
+ }
6173
+ write`</${tagName}>`;
6000
6174
  }
6001
6175
  exit2(tag);
6002
6176
  tag.remove();
@@ -6069,10 +6243,11 @@ function getUsedAttrs(tagName, tag) {
6069
6243
  let skipProps;
6070
6244
  let staticControllable;
6071
6245
  let staticContentAttr;
6246
+ let injectNonce = isInjectNonceTag(tagName);
6072
6247
  for (let i = attributes.length; i--; ) {
6073
6248
  const attr = attributes[i];
6074
6249
  const { value } = attr;
6075
- if (import_compiler30.types.isMarkoSpreadAttribute(attr)) {
6250
+ if (import_compiler33.types.isMarkoSpreadAttribute(attr)) {
6076
6251
  if (!spreadProps) {
6077
6252
  spreadProps = [];
6078
6253
  staticControllable = getRelatedControllable(tagName, seen);
@@ -6086,9 +6261,12 @@ function getUsedAttrs(tagName, tag) {
6086
6261
  staticControllable = void 0;
6087
6262
  }
6088
6263
  }
6089
- spreadProps.push(import_compiler30.types.spreadElement(value));
6264
+ spreadProps.push(import_compiler33.types.spreadElement(value));
6090
6265
  } else if (!(seen[attr.name] || attr.name === "content" && tag.body.body.length)) {
6091
6266
  seen[attr.name] = attr;
6267
+ if (injectNonce && attr.name === "nonce") {
6268
+ injectNonce = false;
6269
+ }
6092
6270
  if (spreadProps) {
6093
6271
  spreadProps.push(toObjectProperty(attr.name, attr.value));
6094
6272
  } else if (attr.name === "content" && tagName !== "meta") {
@@ -6113,25 +6291,37 @@ function getUsedAttrs(tagName, tag) {
6113
6291
  }
6114
6292
  const staticAttrs = [...maybeStaticAttrs].reverse();
6115
6293
  if (spreadProps) {
6116
- spreadProps.reverse();
6117
6294
  if (staticControllable) {
6118
6295
  for (const attr of staticControllable.attrs) {
6119
6296
  if (attr) {
6120
6297
  (skipProps ||= []).push(
6121
- toObjectProperty(attr.name, import_compiler30.types.numericLiteral(1))
6298
+ toObjectProperty(attr.name, import_compiler33.types.numericLiteral(1))
6122
6299
  );
6123
6300
  }
6124
6301
  }
6125
6302
  }
6126
6303
  for (const { name: name2 } of staticAttrs) {
6127
- (skipProps ||= []).push(toObjectProperty(name2, import_compiler30.types.numericLiteral(1)));
6304
+ (skipProps ||= []).push(toObjectProperty(name2, import_compiler33.types.numericLiteral(1)));
6305
+ }
6306
+ if (injectNonce) {
6307
+ injectNonce = false;
6308
+ spreadProps.push(
6309
+ import_compiler33.types.objectProperty(
6310
+ import_compiler33.types.identifier("nonce"),
6311
+ import_compiler33.types.memberExpression(
6312
+ isOutputHTML() ? callRuntime("$global") : toMemberExpression(scopeIdentifier, getAccessorProp().Global),
6313
+ import_compiler33.types.identifier("cspNonce")
6314
+ )
6315
+ )
6316
+ );
6128
6317
  }
6129
- spreadExpression = propsToExpression(spreadProps);
6318
+ spreadExpression = propsToExpression(spreadProps.reverse());
6130
6319
  }
6131
6320
  if (skipProps) {
6132
- skipExpression = import_compiler30.types.objectExpression(skipProps);
6321
+ skipExpression = import_compiler33.types.objectExpression(skipProps);
6133
6322
  }
6134
6323
  return {
6324
+ injectNonce,
6135
6325
  staticAttrs,
6136
6326
  staticContentAttr,
6137
6327
  staticControllable,
@@ -6139,6 +6329,36 @@ function getUsedAttrs(tagName, tag) {
6139
6329
  skipExpression
6140
6330
  };
6141
6331
  }
6332
+ function isInjectNonceTag(tagName) {
6333
+ switch (tagName) {
6334
+ case "script":
6335
+ case "style":
6336
+ return true;
6337
+ default:
6338
+ return false;
6339
+ }
6340
+ }
6341
+ function getCanonicalTagName(tag) {
6342
+ const tagName = getTagName(tag);
6343
+ switch (tagName) {
6344
+ case "html-script":
6345
+ return "script";
6346
+ case "html-style":
6347
+ return "style";
6348
+ default:
6349
+ return tagName;
6350
+ }
6351
+ }
6352
+ function getTextOnlyEscapeHelper(tagName) {
6353
+ switch (tagName) {
6354
+ case "script":
6355
+ return "_escape_script";
6356
+ case "style":
6357
+ return "_escape_style";
6358
+ default:
6359
+ return "_escape_text";
6360
+ }
6361
+ }
6142
6362
  function trackDelimitedAttrValue(expr, meta) {
6143
6363
  switch (expr.type) {
6144
6364
  case "ObjectExpression":
@@ -6216,14 +6436,14 @@ function trackDelimitedAttrObjectProperties(obj, meta) {
6216
6436
  (meta.staticItems ||= []).push(staticProps);
6217
6437
  }
6218
6438
  if (dynamicProps) {
6219
- (meta.dynamicItems ||= []).push(import_compiler30.types.objectExpression(dynamicProps));
6439
+ (meta.dynamicItems ||= []).push(import_compiler33.types.objectExpression(dynamicProps));
6220
6440
  }
6221
6441
  }
6222
6442
  function isNativeTagChangeHandler(propName) {
6223
6443
  return /^(?:value|checked(?:Value)?|open)Change$/.test(propName);
6224
6444
  }
6225
6445
  function buildUndefined2() {
6226
- return import_compiler30.types.unaryExpression("void", import_compiler30.types.numericLiteral(0));
6446
+ return import_compiler33.types.unaryExpression("void", import_compiler33.types.numericLiteral(0));
6227
6447
  }
6228
6448
 
6229
6449
  // src/translator/util/is-only-child-in-parent.ts
@@ -6235,7 +6455,7 @@ function getOnlyChildParentTagName(tag, branchSize = 1) {
6235
6455
  return extra[kOnlyChildInParent];
6236
6456
  }
6237
6457
  const parentTag = getParentTag(tag);
6238
- return extra[kOnlyChildInParent] = parentTag && (0, import_babel_utils21.getTagDef)(parentTag)?.html && parentTag.node.name.type === "StringLiteral" && tag.parent.body.length === branchSize ? parentTag.node.name.value : false;
6458
+ return extra[kOnlyChildInParent] = parentTag && (0, import_babel_utils22.getTagDef)(parentTag)?.html && parentTag.node.name.type === "StringLiteral" && tag.parent.body.length === branchSize ? parentTag.node.name.value : false;
6239
6459
  }
6240
6460
  function getOptimizedOnlyChildNodeBinding(tag, section, branchSize = 1) {
6241
6461
  if (getOnlyChildParentTagName(tag, branchSize)) {
@@ -6267,8 +6487,8 @@ var for_default = {
6267
6487
  isAttrTag ? 4 /* local */ : 5 /* derived */
6268
6488
  );
6269
6489
  let allowAttrs;
6270
- (0, import_babel_utils22.assertNoVar)(tag);
6271
- (0, import_babel_utils22.assertNoArgs)(tag);
6490
+ (0, import_babel_utils23.assertNoVar)(tag);
6491
+ (0, import_babel_utils23.assertNoArgs)(tag);
6272
6492
  assertNoSpreadAttrs(tag);
6273
6493
  switch (getForType(tag.node)) {
6274
6494
  case "of":
@@ -6291,7 +6511,7 @@ var for_default = {
6291
6511
  if (!isAttrTag) {
6292
6512
  allowAttrs.push("by");
6293
6513
  }
6294
- (0, import_babel_utils22.assertAllowedAttributes)(tag, allowAttrs);
6514
+ (0, import_babel_utils23.assertAllowedAttributes)(tag, allowAttrs);
6295
6515
  if (isAttrTag) return;
6296
6516
  const bodySection = startSection(tagBody);
6297
6517
  if (!bodySection) {
@@ -6359,7 +6579,7 @@ var for_default = {
6359
6579
  const forTagArgs = getBaseArgsInForTag(forType, forAttrs);
6360
6580
  const forTagHTMLRuntime = branchSerializeReason ? forTypeToHTMLResumeRuntime(forType) : forTypeToRuntime(forType);
6361
6581
  forTagArgs.push(
6362
- import_compiler32.types.arrowFunctionExpression(params, import_compiler32.types.blockStatement(bodyStatements))
6582
+ import_compiler35.types.arrowFunctionExpression(params, import_compiler35.types.blockStatement(bodyStatements))
6363
6583
  );
6364
6584
  if (branchSerializeReason) {
6365
6585
  const skipParentEnd = onlyChildParentTagName && markerSerializeReason;
@@ -6374,7 +6594,7 @@ var for_default = {
6374
6594
  !statefulSerializeArg
6375
6595
  );
6376
6596
  forTagArgs.push(
6377
- forAttrs.by || import_compiler32.types.numericLiteral(0),
6597
+ forAttrs.by || import_compiler35.types.numericLiteral(0),
6378
6598
  getScopeIdIdentifier(tagSection),
6379
6599
  getScopeAccessorLiteral(nodeBinding),
6380
6600
  getSerializeGuard(
@@ -6387,17 +6607,17 @@ var for_default = {
6387
6607
  );
6388
6608
  if (skipParentEnd) {
6389
6609
  getParentTag(tag).node.extra[kSkipEndTag] = true;
6390
- forTagArgs.push(import_compiler32.types.stringLiteral(`</${onlyChildParentTagName}>`));
6610
+ forTagArgs.push(import_compiler35.types.stringLiteral(`</${onlyChildParentTagName}>`));
6391
6611
  }
6392
6612
  if (singleChild) {
6393
6613
  if (!skipParentEnd) {
6394
- forTagArgs.push(import_compiler32.types.numericLiteral(0));
6614
+ forTagArgs.push(import_compiler35.types.numericLiteral(0));
6395
6615
  }
6396
- forTagArgs.push(import_compiler32.types.numericLiteral(1));
6616
+ forTagArgs.push(import_compiler35.types.numericLiteral(1));
6397
6617
  }
6398
6618
  }
6399
6619
  statements.push(
6400
- import_compiler32.types.expressionStatement(callRuntime(forTagHTMLRuntime, ...forTagArgs))
6620
+ import_compiler35.types.expressionStatement(callRuntime(forTagHTMLRuntime, ...forTagArgs))
6401
6621
  );
6402
6622
  for (const replacement of tag.replaceWithMultiple(statements)) {
6403
6623
  replacement.skip();
@@ -6455,7 +6675,7 @@ var for_default = {
6455
6675
  tagSection,
6456
6676
  referencedBindings,
6457
6677
  signal,
6458
- import_compiler32.types.arrayExpression(loopArgs)
6678
+ import_compiler35.types.arrayExpression(loopArgs)
6459
6679
  );
6460
6680
  tag.remove();
6461
6681
  }
@@ -6533,11 +6753,11 @@ var for_default = {
6533
6753
  ]
6534
6754
  };
6535
6755
  function buildForRuntimeCall(type, attrs, params, statements) {
6536
- return import_compiler32.types.expressionStatement(
6756
+ return import_compiler35.types.expressionStatement(
6537
6757
  callRuntime(
6538
6758
  forTypeToRuntime(type),
6539
6759
  ...getBaseArgsInForTag(type, attrs),
6540
- import_compiler32.types.arrowFunctionExpression(params, import_compiler32.types.blockStatement(statements))
6760
+ import_compiler35.types.arrowFunctionExpression(params, import_compiler35.types.blockStatement(statements))
6541
6761
  )
6542
6762
  );
6543
6763
  }
@@ -6599,14 +6819,14 @@ function getBaseArgsInForTag(type, attrs) {
6599
6819
  case "to":
6600
6820
  return [
6601
6821
  attrs.to,
6602
- attrs.from || import_compiler32.types.numericLiteral(0),
6603
- attrs.step || import_compiler32.types.numericLiteral(1)
6822
+ attrs.from || import_compiler35.types.numericLiteral(0),
6823
+ attrs.step || import_compiler35.types.numericLiteral(1)
6604
6824
  ];
6605
6825
  case "until":
6606
6826
  return [
6607
6827
  attrs.until,
6608
- attrs.from || import_compiler32.types.numericLiteral(0),
6609
- attrs.step || import_compiler32.types.numericLiteral(1)
6828
+ attrs.from || import_compiler35.types.numericLiteral(0),
6829
+ attrs.step || import_compiler35.types.numericLiteral(1)
6610
6830
  ];
6611
6831
  }
6612
6832
  }
@@ -6625,8 +6845,8 @@ function translateAttrs(tag, propTree, skip2, statements = [], contentKey = "con
6625
6845
  seen.add(attrTagMeta.name);
6626
6846
  if (attrTagMeta.dynamic) {
6627
6847
  statements.push(
6628
- import_compiler33.types.variableDeclaration("let", [
6629
- import_compiler33.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta))
6848
+ import_compiler36.types.variableDeclaration("let", [
6849
+ import_compiler36.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta))
6630
6850
  ])
6631
6851
  );
6632
6852
  properties.push(
@@ -6642,7 +6862,7 @@ function translateAttrs(tag, propTree, skip2, statements = [], contentKey = "con
6642
6862
  for (let i = 0; i < attrTags2.length; i++) {
6643
6863
  const child = attrTags2[i];
6644
6864
  if (child.isMarkoTag()) {
6645
- if ((0, import_babel_utils23.isAttributeTag)(child)) {
6865
+ if ((0, import_babel_utils24.isAttributeTag)(child)) {
6646
6866
  const attrTagMeta = attrTagLookup[getTagName(child)];
6647
6867
  if (attrTagMeta.dynamic) {
6648
6868
  i = addDynamicAttrTagStatements(
@@ -6708,8 +6928,8 @@ function translateAttrs(tag, propTree, skip2, statements = [], contentKey = "con
6708
6928
  if (!seen.has(contentKey) && usesExport(templateExports, contentKey)) {
6709
6929
  const contentExpression = buildContent(tag.get("body"));
6710
6930
  if (contentExpression) {
6711
- const contentProp = import_compiler33.types.objectProperty(
6712
- import_compiler33.types.identifier(contentKey),
6931
+ const contentProp = import_compiler36.types.objectProperty(
6932
+ import_compiler36.types.identifier(contentKey),
6713
6933
  contentExpression
6714
6934
  );
6715
6935
  seen.add(contentKey);
@@ -6721,8 +6941,8 @@ function translateAttrs(tag, propTree, skip2, statements = [], contentKey = "con
6721
6941
  for (let i = attributes.length; i--; ) {
6722
6942
  const attr = attributes[i];
6723
6943
  const { value } = attr;
6724
- if (import_compiler33.types.isMarkoSpreadAttribute(attr)) {
6725
- properties.push(import_compiler33.types.spreadElement(value));
6944
+ if (import_compiler36.types.isMarkoSpreadAttribute(attr)) {
6945
+ properties.push(import_compiler36.types.spreadElement(value));
6726
6946
  } else if (!seen.has(attr.name) && usesExport(templateExports, attr.name)) {
6727
6947
  seen.add(attr.name);
6728
6948
  properties.push(toObjectProperty(attr.name, value));
@@ -6741,7 +6961,7 @@ function getTranslatedBodyContentProperty(props) {
6741
6961
  function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements, templateExports, contentKey = "content") {
6742
6962
  const tag = attrTags2[index];
6743
6963
  if (tag.isMarkoTag()) {
6744
- if ((0, import_babel_utils23.isAttributeTag)(tag)) {
6964
+ if ((0, import_babel_utils24.isAttributeTag)(tag)) {
6745
6965
  const attrTagMeta = attrTagLookup[getTagName(tag)];
6746
6966
  if (usesExport(templateExports, attrTagMeta.name) && attrTagMeta.dynamic) {
6747
6967
  const translatedAttrTag = translateAttrs(
@@ -6753,8 +6973,8 @@ function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements
6753
6973
  );
6754
6974
  if (attrTagMeta.repeated) {
6755
6975
  statements.push(
6756
- import_compiler33.types.expressionStatement(
6757
- import_compiler33.types.assignmentExpression(
6976
+ import_compiler36.types.expressionStatement(
6977
+ import_compiler36.types.assignmentExpression(
6758
6978
  "=",
6759
6979
  getAttrTagIdentifier(attrTagMeta),
6760
6980
  callRuntime(
@@ -6767,8 +6987,8 @@ function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements
6767
6987
  );
6768
6988
  } else {
6769
6989
  statements.push(
6770
- import_compiler33.types.expressionStatement(
6771
- import_compiler33.types.assignmentExpression(
6990
+ import_compiler36.types.expressionStatement(
6991
+ import_compiler36.types.assignmentExpression(
6772
6992
  "=",
6773
6993
  getAttrTagIdentifier(attrTagMeta),
6774
6994
  callRuntime(
@@ -6807,7 +7027,7 @@ function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements
6807
7027
  return index;
6808
7028
  }
6809
7029
  function propsToExpression(props) {
6810
- return props.length === 1 && import_compiler33.types.isSpreadElement(props[0]) ? props[0].argument : import_compiler33.types.objectExpression(props);
7030
+ return props.length === 1 && import_compiler36.types.isSpreadElement(props[0]) ? props[0].argument : import_compiler36.types.objectExpression(props);
6811
7031
  }
6812
7032
  function translateForAttrTag(attrTags2, index, attrTagLookup, statements, templateExports, contentKey) {
6813
7033
  const forTag = attrTags2[index];
@@ -6832,9 +7052,9 @@ function translateForAttrTag(attrTags2, index, attrTagLookup, statements, templa
6832
7052
  function translateIfAttrTag(attrTags2, index, attrTagLookup, statements, templateExports, contentKey) {
6833
7053
  const ifTag = attrTags2[index];
6834
7054
  const consequentStatements = [];
6835
- let ifStatement = import_compiler33.types.ifStatement(
7055
+ let ifStatement = import_compiler36.types.ifStatement(
6836
7056
  getConditionTestValue(ifTag),
6837
- import_compiler33.types.blockStatement(consequentStatements)
7057
+ import_compiler36.types.blockStatement(consequentStatements)
6838
7058
  );
6839
7059
  statements.push(ifStatement);
6840
7060
  addAllAttrTagsAsDynamic(
@@ -6861,14 +7081,14 @@ function translateIfAttrTag(attrTags2, index, attrTagLookup, statements, templat
6861
7081
  contentKey
6862
7082
  );
6863
7083
  if (testValue) {
6864
- ifStatement.alternate = ifStatement = import_compiler33.types.ifStatement(
7084
+ ifStatement.alternate = ifStatement = import_compiler36.types.ifStatement(
6865
7085
  testValue,
6866
- import_compiler33.types.blockStatement(alternateStatements)
7086
+ import_compiler36.types.blockStatement(alternateStatements)
6867
7087
  );
6868
7088
  nextIndex++;
6869
7089
  continue;
6870
7090
  } else {
6871
- ifStatement.alternate = import_compiler33.types.blockStatement(alternateStatements);
7091
+ ifStatement.alternate = import_compiler36.types.blockStatement(alternateStatements);
6872
7092
  break;
6873
7093
  }
6874
7094
  }
@@ -6934,9 +7154,9 @@ function buildContent(body) {
6934
7154
  }
6935
7155
  if (dynamicSerializeReason) {
6936
7156
  body.node.body.unshift(
6937
- import_compiler33.types.variableDeclaration("const", [
6938
- import_compiler33.types.variableDeclarator(
6939
- import_compiler33.types.identifier(
7157
+ import_compiler36.types.variableDeclaration("const", [
7158
+ import_compiler36.types.variableDeclarator(
7159
+ import_compiler36.types.identifier(
6940
7160
  getSharedUid(`scope${bodySection.id}_reason`, bodySection)
6941
7161
  ),
6942
7162
  callRuntime("_scope_reason")
@@ -6946,10 +7166,10 @@ function buildContent(body) {
6946
7166
  }
6947
7167
  return callRuntime(
6948
7168
  serialized ? "_content_resume" : "_content",
6949
- import_compiler33.types.stringLiteral(getResumeRegisterId(bodySection, "content")),
6950
- import_compiler33.types.arrowFunctionExpression(
7169
+ import_compiler36.types.stringLiteral(getResumeRegisterId(bodySection, "content")),
7170
+ import_compiler36.types.arrowFunctionExpression(
6951
7171
  body.node.params,
6952
- import_compiler33.types.blockStatement(body.node.body)
7172
+ import_compiler36.types.blockStatement(body.node.body)
6953
7173
  ),
6954
7174
  serialized ? getScopeIdIdentifier(
6955
7175
  getSection(
@@ -6960,17 +7180,17 @@ function buildContent(body) {
6960
7180
  ) : void 0
6961
7181
  );
6962
7182
  } else {
6963
- return import_compiler33.types.callExpression(
6964
- import_compiler33.types.identifier(bodySection.name),
7183
+ return import_compiler36.types.callExpression(
7184
+ import_compiler36.types.identifier(bodySection.name),
6965
7185
  bodySection.referencedLocalClosures ? [
6966
7186
  scopeIdentifier,
6967
- import_compiler33.types.objectExpression(
7187
+ import_compiler36.types.objectExpression(
6968
7188
  toArray(bodySection.referencedLocalClosures, (ref) => {
6969
7189
  const accessor = getScopeAccessor(ref, true);
6970
7190
  const isShorthand = accessor === ref.name;
6971
- return import_compiler33.types.objectProperty(
7191
+ return import_compiler36.types.objectProperty(
6972
7192
  toPropertyName(accessor),
6973
- import_compiler33.types.identifier(ref.name),
7193
+ import_compiler36.types.identifier(ref.name),
6974
7194
  false,
6975
7195
  isShorthand
6976
7196
  );
@@ -7055,8 +7275,8 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
7055
7275
  if (childScopeSerializeReason) {
7056
7276
  const peekScopeId = generateUidIdentifier(childScopeBinding?.name);
7057
7277
  tag.insertBefore(
7058
- import_compiler34.types.variableDeclaration("const", [
7059
- import_compiler34.types.variableDeclarator(peekScopeId, callRuntime("_peek_scope_id"))
7278
+ import_compiler37.types.variableDeclaration("const", [
7279
+ import_compiler37.types.variableDeclarator(peekScopeId, callRuntime("_peek_scope_id"))
7060
7280
  ])
7061
7281
  );
7062
7282
  setBindingSerializedValue(
@@ -7066,13 +7286,13 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
7066
7286
  );
7067
7287
  if (tagVar) {
7068
7288
  statements.push(
7069
- import_compiler34.types.expressionStatement(
7289
+ import_compiler37.types.expressionStatement(
7070
7290
  callRuntime(
7071
7291
  "_var",
7072
7292
  getScopeIdIdentifier(section),
7073
7293
  getScopeAccessorLiteral(tag.node.extra[kChildOffsetScopeBinding]),
7074
7294
  peekScopeId,
7075
- import_compiler34.types.stringLiteral(
7295
+ import_compiler37.types.stringLiteral(
7076
7296
  getResumeRegisterId(
7077
7297
  section,
7078
7298
  node.var.extra?.binding,
@@ -7101,9 +7321,9 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
7101
7321
  if (reason) {
7102
7322
  hasDynamicReasons ||= reason !== true && !reason.state;
7103
7323
  props.push(
7104
- import_compiler34.types.objectProperty(
7324
+ import_compiler37.types.objectProperty(
7105
7325
  withLeadingComment(
7106
- import_compiler34.types.numericLiteral(i),
7326
+ import_compiler37.types.numericLiteral(i),
7107
7327
  getDebugNames(group.reason)
7108
7328
  ),
7109
7329
  getSerializeGuard(section, reason, false)
@@ -7114,12 +7334,12 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
7114
7334
  }
7115
7335
  }
7116
7336
  if (props.length) {
7117
- childSerializeReasonExpr = hasDynamicReasons || hasSkippedReasons ? import_compiler34.types.objectExpression(props) : import_compiler34.types.numericLiteral(1);
7337
+ childSerializeReasonExpr = hasDynamicReasons || hasSkippedReasons ? import_compiler37.types.objectExpression(props) : import_compiler37.types.numericLiteral(1);
7118
7338
  }
7119
7339
  }
7120
7340
  if (childSerializeReasonExpr) {
7121
7341
  tag.insertBefore(
7122
- import_compiler34.types.expressionStatement(
7342
+ import_compiler37.types.expressionStatement(
7123
7343
  callRuntime("_set_serialize_reason", childSerializeReasonExpr)
7124
7344
  )
7125
7345
  );
@@ -7135,39 +7355,7 @@ function knownTagTranslateHTML(tag, tagIdentifier, contentSection, propTree) {
7135
7355
  }
7136
7356
  return renderArgs;
7137
7357
  };
7138
- if (node.extra.tagNameNullable) {
7139
- const contentProp = getTranslatedBodyContentProperty(properties);
7140
- let contentId = void 0;
7141
- if (contentProp) {
7142
- const contentExpression = contentProp.value;
7143
- contentProp.value = contentId = generateUidIdentifier("content");
7144
- const [contentPath] = tag.insertBefore(
7145
- import_compiler34.types.variableDeclaration("const", [
7146
- import_compiler34.types.variableDeclarator(
7147
- contentId,
7148
- // TODO: only register if needed (child template analysis)
7149
- contentExpression
7150
- )
7151
- ])
7152
- );
7153
- contentPath.skip();
7154
- }
7155
- let renderTagExpr = callExpression(
7156
- tagIdentifier,
7157
- ...getArgs()
7158
- );
7159
- if (tagVar) {
7160
- translateVar(tag, import_compiler34.types.unaryExpression("void", import_compiler34.types.numericLiteral(0)), "let");
7161
- renderTagExpr = import_compiler34.types.assignmentExpression("=", tagVar, renderTagExpr);
7162
- }
7163
- statements.push(
7164
- import_compiler34.types.ifStatement(
7165
- tagIdentifier,
7166
- import_compiler34.types.expressionStatement(renderTagExpr),
7167
- contentId && callStatement(contentId)
7168
- )
7169
- );
7170
- } else if (tagVar) {
7358
+ if (tagVar) {
7171
7359
  translateVar(tag, callExpression(tagIdentifier, ...getArgs()), "let");
7172
7360
  } else {
7173
7361
  statements.push(callStatement(tagIdentifier, ...getArgs()));
@@ -7194,15 +7382,15 @@ function knownTagTranslateDOM(tag, propTree, getBindingIdentifier, callSetup) {
7194
7382
  value
7195
7383
  ];
7196
7384
  if (!isOptimize()) {
7197
- changeArgs.push(import_compiler34.types.stringLiteral(varBinding.name));
7385
+ changeArgs.push(import_compiler37.types.stringLiteral(varBinding.name));
7198
7386
  }
7199
- return import_compiler34.types.callExpression(importRuntime("_var_change"), changeArgs);
7387
+ return import_compiler37.types.callExpression(importRuntime("_var_change"), changeArgs);
7200
7388
  };
7201
7389
  addStatement(
7202
7390
  "render",
7203
7391
  tagSection,
7204
7392
  void 0,
7205
- import_compiler34.types.expressionStatement(
7393
+ import_compiler37.types.expressionStatement(
7206
7394
  callRuntime(
7207
7395
  "_var",
7208
7396
  scopeIdentifier,
@@ -7247,7 +7435,7 @@ function analyzeParams(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7247
7435
  dropReferences(getAllTagReferenceNodes(tag.node));
7248
7436
  return inputExpr;
7249
7437
  }
7250
- if (!propTree.props || tag.node.arguments?.some((node) => import_compiler34.types.isSpreadElement(node))) {
7438
+ if (!propTree.props || tag.node.arguments?.some((node) => import_compiler37.types.isSpreadElement(node))) {
7251
7439
  const extra = inputExpr.value = mergeReferences(
7252
7440
  section,
7253
7441
  tag.node,
@@ -7322,7 +7510,7 @@ function analyzeAttrs(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7322
7510
  const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
7323
7511
  for (const child of attrTags2) {
7324
7512
  if (child.isMarkoTag()) {
7325
- if ((0, import_babel_utils24.isAttributeTag)(child)) {
7513
+ if ((0, import_babel_utils25.isAttributeTag)(child)) {
7326
7514
  const attrTagMeta = attrTagLookup[getTagName(child)];
7327
7515
  const childAttrExports = propTree.props[attrTagMeta.name];
7328
7516
  if (childAttrExports) {
@@ -7398,7 +7586,7 @@ function analyzeAttrs(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7398
7586
  let spreadReferenceNodes;
7399
7587
  for (let i = attributes.length; i--; ) {
7400
7588
  const attr = attributes[i];
7401
- if (import_compiler34.types.isMarkoAttribute(attr)) {
7589
+ if (import_compiler37.types.isMarkoAttribute(attr)) {
7402
7590
  const templateExportAttr = propTree.props[attr.name];
7403
7591
  if (!templateExportAttr || seen.has(attr.name)) {
7404
7592
  unknownReferences.push(attr.value);
@@ -7412,7 +7600,7 @@ function analyzeAttrs(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7412
7600
  }
7413
7601
  if (spreadReferenceNodes) {
7414
7602
  spreadReferenceNodes.push(attr.value);
7415
- } else if (import_compiler34.types.isMarkoSpreadAttribute(attr)) {
7603
+ } else if (import_compiler37.types.isMarkoSpreadAttribute(attr)) {
7416
7604
  spreadReferenceNodes = [attr.value];
7417
7605
  } else {
7418
7606
  const attrValueExtra = attr.value.extra ??= {};
@@ -7454,7 +7642,7 @@ function analyzeAttrs(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7454
7642
  return inputExpr;
7455
7643
  }
7456
7644
  function writeParamsToSignals(tag, propTree, importAlias, info) {
7457
- if (!propTree.props || tag.node.arguments?.some((node) => import_compiler34.types.isSpreadElement(node))) {
7645
+ if (!propTree.props || tag.node.arguments?.some((node) => import_compiler37.types.isSpreadElement(node))) {
7458
7646
  const referencedBindings = tag.node.extra?.referencedBindings;
7459
7647
  const tagInputIdentifier = info.getBindingIdentifier(
7460
7648
  propTree.binding,
@@ -7482,8 +7670,8 @@ function writeParamsToSignals(tag, propTree, importAlias, info) {
7482
7670
  "render",
7483
7671
  info.tagSection,
7484
7672
  referencedBindings,
7485
- import_compiler34.types.expressionStatement(
7486
- import_compiler34.types.callExpression(tagInputIdentifier, [import_compiler34.types.arrayExpression(renderArgs)])
7673
+ import_compiler37.types.expressionStatement(
7674
+ import_compiler37.types.callExpression(tagInputIdentifier, [import_compiler37.types.arrayExpression(renderArgs)])
7487
7675
  )
7488
7676
  );
7489
7677
  return;
@@ -7502,8 +7690,8 @@ function writeParamsToSignals(tag, propTree, importAlias, info) {
7502
7690
  info.tagSection,
7503
7691
  arg.extra?.referencedBindings,
7504
7692
  // TODO: pretty sure content needs to have the reference group of it's param defaults.
7505
- import_compiler34.types.expressionStatement(
7506
- import_compiler34.types.callExpression(argExportIdentifier, [
7693
+ import_compiler37.types.expressionStatement(
7694
+ import_compiler37.types.callExpression(argExportIdentifier, [
7507
7695
  createScopeReadExpression(
7508
7696
  info.childScopeBinding,
7509
7697
  info.tagSection
@@ -7555,7 +7743,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7555
7743
  for (let i = 0; i < attrTags2.length; i++) {
7556
7744
  const child = attrTags2[i];
7557
7745
  if (child.isMarkoTag()) {
7558
- if ((0, import_babel_utils24.isAttributeTag)(child)) {
7746
+ if ((0, import_babel_utils25.isAttributeTag)(child)) {
7559
7747
  const attrTagMeta = attrTagLookup[getTagName(child)];
7560
7748
  const childAttrExport = propTree.props[attrTagMeta.name];
7561
7749
  if (childAttrExport) {
@@ -7591,17 +7779,17 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7591
7779
  childAttrExports.binding,
7592
7780
  `${importAlias}_${attrTagMeta.name}`
7593
7781
  );
7594
- decls.push(import_compiler34.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta)));
7782
+ decls.push(import_compiler37.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta)));
7595
7783
  addStatement("render", info.tagSection, referencedBindings, [
7596
- import_compiler34.types.variableDeclaration("let", decls),
7784
+ import_compiler37.types.variableDeclaration("let", decls),
7597
7785
  ...statements
7598
7786
  ]);
7599
7787
  addStatement(
7600
7788
  "render",
7601
7789
  info.tagSection,
7602
7790
  referencedBindings,
7603
- import_compiler34.types.expressionStatement(
7604
- import_compiler34.types.callExpression(attrExportIdentifier, [
7791
+ import_compiler37.types.expressionStatement(
7792
+ import_compiler37.types.callExpression(attrExportIdentifier, [
7605
7793
  createScopeReadExpression(
7606
7794
  info.childScopeBinding,
7607
7795
  info.tagSection
@@ -7626,13 +7814,13 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7626
7814
  info.tagSection,
7627
7815
  void 0,
7628
7816
  // TODO: pretty sure content needs to have the reference group of it's param defaults.
7629
- import_compiler34.types.expressionStatement(
7630
- import_compiler34.types.callExpression(contentExportIdentifier, [
7817
+ import_compiler37.types.expressionStatement(
7818
+ import_compiler37.types.callExpression(contentExportIdentifier, [
7631
7819
  createScopeReadExpression(
7632
7820
  info.childScopeBinding,
7633
7821
  info.tagSection
7634
7822
  ),
7635
- import_compiler34.types.callExpression(import_compiler34.types.identifier(bodySection.name), [
7823
+ import_compiler37.types.callExpression(import_compiler37.types.identifier(bodySection.name), [
7636
7824
  scopeIdentifier
7637
7825
  ])
7638
7826
  ])
@@ -7645,7 +7833,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7645
7833
  let spreadProps;
7646
7834
  for (let i = attributes.length; i--; ) {
7647
7835
  const attr = attributes[i];
7648
- if (import_compiler34.types.isMarkoAttribute(attr)) {
7836
+ if (import_compiler37.types.isMarkoAttribute(attr)) {
7649
7837
  const childAttrExports = propTree.props[attr.name];
7650
7838
  if (!childAttrExports || seen.has(attr.name)) continue;
7651
7839
  if (spreadProps) {
@@ -7655,9 +7843,9 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7655
7843
  seen.add(attr.name);
7656
7844
  staticAttrs.push(attr);
7657
7845
  } else if (spreadProps) {
7658
- spreadProps.push(import_compiler34.types.spreadElement(attr.value));
7846
+ spreadProps.push(import_compiler37.types.spreadElement(attr.value));
7659
7847
  } else {
7660
- spreadProps = [import_compiler34.types.spreadElement(attr.value)];
7848
+ spreadProps = [import_compiler37.types.spreadElement(attr.value)];
7661
7849
  }
7662
7850
  }
7663
7851
  for (const attr of staticAttrs.reverse()) {
@@ -7670,8 +7858,8 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7670
7858
  "render",
7671
7859
  info.tagSection,
7672
7860
  attr.value.extra?.referencedBindings,
7673
- import_compiler34.types.expressionStatement(
7674
- import_compiler34.types.callExpression(attrExportIdentifier, [
7861
+ import_compiler37.types.expressionStatement(
7862
+ import_compiler37.types.callExpression(attrExportIdentifier, [
7675
7863
  createScopeReadExpression(info.childScopeBinding, info.tagSection),
7676
7864
  attr.value
7677
7865
  ])
@@ -7691,11 +7879,11 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7691
7879
  } else {
7692
7880
  spreadId = generateUidIdentifier(`${importAlias}_spread`);
7693
7881
  if (translatedAttrs) {
7694
- translatedAttrs.properties = [import_compiler34.types.spreadElement(spreadId)];
7882
+ translatedAttrs.properties = [import_compiler37.types.spreadElement(spreadId)];
7695
7883
  }
7696
7884
  addStatement("render", info.tagSection, referencedBindings, [
7697
- import_compiler34.types.variableDeclaration("const", [
7698
- import_compiler34.types.variableDeclarator(spreadId, spreadExpr)
7885
+ import_compiler37.types.variableDeclaration("const", [
7886
+ import_compiler37.types.variableDeclarator(spreadId, spreadExpr)
7699
7887
  ])
7700
7888
  ]);
7701
7889
  }
@@ -7710,15 +7898,15 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7710
7898
  "render",
7711
7899
  info.tagSection,
7712
7900
  referencedBindings,
7713
- import_compiler34.types.expressionStatement(
7714
- import_compiler34.types.callExpression(
7901
+ import_compiler37.types.expressionStatement(
7902
+ import_compiler37.types.callExpression(
7715
7903
  attrExportIdentifier,
7716
7904
  spreadId ? [
7717
7905
  createScopeReadExpression(
7718
7906
  info.childScopeBinding,
7719
7907
  info.tagSection
7720
7908
  ),
7721
- toMemberExpression(import_compiler34.types.cloneNode(spreadId, true), name2)
7909
+ toMemberExpression(import_compiler37.types.cloneNode(spreadId, true), name2)
7722
7910
  ] : [
7723
7911
  createScopeReadExpression(
7724
7912
  info.childScopeBinding,
@@ -7758,12 +7946,12 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7758
7946
  let translatedProps = propsToExpression(translatedAttrs.properties);
7759
7947
  if (propTree.rest && spreadId) {
7760
7948
  const props = [];
7761
- const restId = import_compiler34.types.identifier(propTree.rest.binding.name);
7949
+ const restId = import_compiler37.types.identifier(propTree.rest.binding.name);
7762
7950
  forEach(propTree.rest.binding.excludeProperties, (name2) => {
7763
7951
  const propId = toPropertyName(name2);
7764
- const shorthand = propId.type === "Identifier" && import_compiler34.types.isValidIdentifier(name2);
7952
+ const shorthand = propId.type === "Identifier" && import_compiler37.types.isValidIdentifier(name2);
7765
7953
  props.push(
7766
- import_compiler34.types.objectProperty(
7954
+ import_compiler37.types.objectProperty(
7767
7955
  propId,
7768
7956
  shorthand ? propId : generateUidIdentifier(name2),
7769
7957
  false,
@@ -7771,13 +7959,13 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7771
7959
  )
7772
7960
  );
7773
7961
  });
7774
- props.push(import_compiler34.types.restElement(restId));
7775
- translatedProps = import_compiler34.types.callExpression(
7776
- import_compiler34.types.arrowFunctionExpression([import_compiler34.types.objectPattern(props)], restId),
7962
+ props.push(import_compiler37.types.restElement(restId));
7963
+ translatedProps = import_compiler37.types.callExpression(
7964
+ import_compiler37.types.arrowFunctionExpression([import_compiler37.types.objectPattern(props)], restId),
7777
7965
  [spreadId]
7778
7966
  );
7779
7967
  }
7780
- if ((0, import_babel_utils24.isAttributeTag)(tag)) {
7968
+ if ((0, import_babel_utils25.isAttributeTag)(tag)) {
7781
7969
  const attrTagName = getTagName(tag);
7782
7970
  const parentTag = tag.parentPath;
7783
7971
  const repeated = analyzeAttributeTags(parentTag)?.[attrTagName]?.repeated;
@@ -7802,7 +7990,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7802
7990
  } else {
7803
7991
  attrTagCallsForTag.set(
7804
7992
  attrTagName,
7805
- translatedProps = import_compiler34.types.parenthesizedExpression(
7993
+ translatedProps = import_compiler37.types.parenthesizedExpression(
7806
7994
  callRuntime("attrTag", translatedProps)
7807
7995
  )
7808
7996
  );
@@ -7815,8 +8003,8 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
7815
8003
  "render",
7816
8004
  info.tagSection,
7817
8005
  referencedBindings,
7818
- import_compiler34.types.expressionStatement(
7819
- import_compiler34.types.callExpression(tagInputIdentifier, [
8006
+ import_compiler37.types.expressionStatement(
8007
+ import_compiler37.types.callExpression(tagInputIdentifier, [
7820
8008
  createScopeReadExpression(info.childScopeBinding, info.tagSection),
7821
8009
  translatedProps
7822
8010
  ])
@@ -7851,10 +8039,10 @@ function mapParamReasonToExpr(exprs, reason) {
7851
8039
  }
7852
8040
  }
7853
8041
  function callStatement(id, ...args) {
7854
- return import_compiler34.types.expressionStatement(callExpression(id, ...args));
8042
+ return import_compiler37.types.expressionStatement(callExpression(id, ...args));
7855
8043
  }
7856
8044
  function callExpression(id, ...args) {
7857
- return import_compiler34.types.callExpression(id, args.filter(Boolean));
8045
+ return import_compiler37.types.callExpression(id, args.filter(Boolean));
7858
8046
  }
7859
8047
  function isSimpleReference(expr) {
7860
8048
  switch (expr.type) {
@@ -7917,7 +8105,7 @@ function trackDomVarReferences(tag, binding) {
7917
8105
  if (!tagVar) {
7918
8106
  return;
7919
8107
  }
7920
- if (!import_compiler35.types.isIdentifier(tagVar)) {
8108
+ if (!import_compiler38.types.isIdentifier(tagVar)) {
7921
8109
  throw tag.get("var").buildCodeFrameError(
7922
8110
  "Tag variables on native elements cannot be destructured."
7923
8111
  );
@@ -8017,7 +8205,7 @@ function trackParamsReferences(body, type, upstreamAlias) {
8017
8205
  void 0,
8018
8206
  i > 0 ? addNumericPropertiesUntil(void 0, i - 1) : void 0
8019
8207
  );
8020
- } else if (import_compiler35.types.isLVal(param)) {
8208
+ } else if (import_compiler38.types.isLVal(param)) {
8021
8209
  createBindingsAndTrackReferences(
8022
8210
  param,
8023
8211
  type,
@@ -8222,7 +8410,7 @@ function createBindingsAndTrackReferences(lVal, type, scope, section, upstreamAl
8222
8410
  if (hasRest) {
8223
8411
  excludeProperties = propsUtil.add(excludeProperties, key);
8224
8412
  }
8225
- if (import_compiler35.types.isLVal(prop.value)) {
8413
+ if (import_compiler38.types.isLVal(prop.value)) {
8226
8414
  createBindingsAndTrackReferences(
8227
8415
  prop.value,
8228
8416
  type,
@@ -8262,7 +8450,7 @@ function createBindingsAndTrackReferences(lVal, type, scope, section, upstreamAl
8262
8450
  property,
8263
8451
  excludeProperties
8264
8452
  );
8265
- } else if (import_compiler35.types.isLVal(element)) {
8453
+ } else if (import_compiler38.types.isLVal(element)) {
8266
8454
  createBindingsAndTrackReferences(
8267
8455
  element,
8268
8456
  type,
@@ -8285,7 +8473,7 @@ function trackReference(referencePath, binding) {
8285
8473
  let propPath = binding.name;
8286
8474
  while (true) {
8287
8475
  const { parent } = root;
8288
- if (!import_compiler35.types.isMemberExpression(parent) && !import_compiler35.types.isOptionalMemberExpression(parent))
8476
+ if (!import_compiler38.types.isMemberExpression(parent) && !import_compiler38.types.isOptionalMemberExpression(parent))
8289
8477
  break;
8290
8478
  const prop = getMemberExpressionPropString(parent);
8291
8479
  if (prop === void 0) break;
@@ -8626,7 +8814,7 @@ function finalizeReferences() {
8626
8814
  });
8627
8815
  }
8628
8816
  });
8629
- const programExtra = (0, import_babel_utils25.getProgram)().node.extra;
8817
+ const programExtra = (0, import_babel_utils26.getProgram)().node.extra;
8630
8818
  if (programExtra.returnValueExpr) {
8631
8819
  programExtra.section.returnSerializeReason = getSerializeSourcesForExpr(
8632
8820
  programExtra.returnValueExpr
@@ -8858,11 +9046,11 @@ function getAllTagReferenceNodes(tag, referenceNodes = []) {
8858
9046
  function getScopeAccessorLiteral(binding, encoded, includeId) {
8859
9047
  const canonicalBinding = getCanonicalBinding(binding);
8860
9048
  if (isOptimize()) {
8861
- return encoded ? import_compiler35.types.numericLiteral(canonicalBinding.id) : import_compiler35.types.stringLiteral(decodeAccessor(canonicalBinding.id));
9049
+ return encoded ? import_compiler38.types.numericLiteral(canonicalBinding.id) : import_compiler38.types.stringLiteral(decodeAccessor(canonicalBinding.id));
8862
9050
  } else if (includeId || canonicalBinding.type === 0 /* dom */) {
8863
- return import_compiler35.types.stringLiteral(`${canonicalBinding.name}/${canonicalBinding.id}`);
9051
+ return import_compiler38.types.stringLiteral(`${canonicalBinding.name}/${canonicalBinding.id}`);
8864
9052
  }
8865
- return import_compiler35.types.stringLiteral(canonicalBinding.name);
9053
+ return import_compiler38.types.stringLiteral(canonicalBinding.name);
8866
9054
  }
8867
9055
  function getScopeAccessor(binding, encoded, includeId) {
8868
9056
  const canonicalBinding = getCanonicalBinding(binding);
@@ -8910,7 +9098,7 @@ function getSectionInstancesAccessor(section) {
8910
9098
  }
8911
9099
  function getSectionInstancesAccessorLiteral(section) {
8912
9100
  const accessor = getSectionInstancesAccessor(section);
8913
- return accessor ? typeof accessor === "number" ? import_compiler35.types.numericLiteral(accessor) : import_compiler35.types.stringLiteral(accessor) : void 0;
9101
+ return accessor ? typeof accessor === "number" ? import_compiler38.types.numericLiteral(accessor) : import_compiler38.types.stringLiteral(accessor) : void 0;
8914
9102
  }
8915
9103
  function getReadReplacement(node) {
8916
9104
  const { extra } = node;
@@ -8923,13 +9111,13 @@ function getReadReplacement(node) {
8923
9111
  if (isOutputDOM()) {
8924
9112
  if (readBinding.type === 0 /* dom */) {
8925
9113
  if (!extra[kIsInvoked] && readBinding.section.domGetterBindings.has(readBinding)) {
8926
- replacement = import_compiler35.types.callExpression(
9114
+ replacement = import_compiler38.types.callExpression(
8927
9115
  getBindingGetterIdentifier(readBinding),
8928
9116
  [getScopeExpression(extra.section, readBinding.section)]
8929
9117
  );
8930
9118
  }
8931
9119
  } else if (readBinding.type === 6 /* hoist */ && extra[kIsInvoked]) {
8932
- replacement = import_compiler35.types.callExpression(
9120
+ replacement = import_compiler38.types.callExpression(
8933
9121
  getBindingGetterIdentifier(readBinding),
8934
9122
  [getScopeExpression(extra.section, readBinding.section)]
8935
9123
  );
@@ -8938,7 +9126,7 @@ function getReadReplacement(node) {
8938
9126
  }
8939
9127
  } else {
8940
9128
  if (node.type !== "Identifier") {
8941
- replacement = import_compiler35.types.identifier(readBinding.name);
9129
+ replacement = import_compiler38.types.identifier(readBinding.name);
8942
9130
  } else if (readBinding.name !== node.name && readBinding.type !== 0 /* dom */ && (readBinding.type !== 6 /* hoist */ || !extra[kIsInvoked])) {
8943
9131
  node.name = readBinding.name;
8944
9132
  }
@@ -8948,7 +9136,7 @@ function getReadReplacement(node) {
8948
9136
  let curNode = node;
8949
9137
  let curBinding = read.binding;
8950
9138
  let replaceMember;
8951
- replacement = isOutputDOM() ? createScopeReadExpression(read.binding, extra.section) : import_compiler35.types.identifier(read.binding.name);
9139
+ replacement = isOutputDOM() ? createScopeReadExpression(read.binding, extra.section) : import_compiler38.types.identifier(read.binding.name);
8952
9140
  while (props.length && (curNode.type === "MemberExpression" || curNode.type === "OptionalMemberExpression")) {
8953
9141
  const prop = props.pop();
8954
9142
  const memberProp = getMemberExpressionPropString(curNode);
@@ -9164,7 +9352,7 @@ function getAllSerializeReasonsForExtra(extra) {
9164
9352
  let reason = serializeReasonCache.get(extra);
9165
9353
  if (reason === false) return;
9166
9354
  if (reason === void 0) {
9167
- if (extra === (0, import_babel_utils25.getProgram)().node.extra?.returnValueExpr) {
9355
+ if (extra === (0, import_babel_utils26.getProgram)().node.extra?.returnValueExpr) {
9168
9356
  reason = true;
9169
9357
  } else {
9170
9358
  forEach(extra.downstream, (binding) => {
@@ -9226,10 +9414,10 @@ function addNumericPropertiesUntil(props, len) {
9226
9414
  var kDOMBinding = Symbol("await tag dom binding");
9227
9415
  var await_default = {
9228
9416
  analyze(tag) {
9229
- (0, import_babel_utils26.assertNoVar)(tag);
9230
- (0, import_babel_utils26.assertNoArgs)(tag);
9417
+ (0, import_babel_utils27.assertNoVar)(tag);
9418
+ (0, import_babel_utils27.assertNoArgs)(tag);
9231
9419
  assertNoSpreadAttrs(tag);
9232
- (0, import_babel_utils26.assertNoAttributeTags)(tag);
9420
+ (0, import_babel_utils27.assertNoAttributeTags)(tag);
9233
9421
  const { node } = tag;
9234
9422
  const tagBody = tag.get("body");
9235
9423
  const section = getOrCreateSection(tag);
@@ -9241,7 +9429,7 @@ var await_default = {
9241
9429
  "The [`<await>` tag](https://markojs.com/docs/reference/core-tag#await) requires a [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
9242
9430
  );
9243
9431
  }
9244
- if (node.attributes.length > 1 || !import_compiler36.types.isMarkoAttribute(valueAttr) || valueAttr.name !== "value") {
9432
+ if (node.attributes.length > 1 || !import_compiler39.types.isMarkoAttribute(valueAttr) || valueAttr.name !== "value") {
9245
9433
  throw tag.get("name").buildCodeFrameError(
9246
9434
  "The [`<await>` tag](https://markojs.com/docs/reference/core-tag#await) only supports the [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
9247
9435
  );
@@ -9251,7 +9439,7 @@ var await_default = {
9251
9439
  "The [`<await>` tag](https://markojs.com/docs/reference/core-tag#await) requires [content](https://markojs.com/docs/reference/language#tag-content)."
9252
9440
  );
9253
9441
  }
9254
- if (node.body.params.length && (node.body.params.length > 1 || import_compiler36.types.isSpreadElement(node.body.params[0]))) {
9442
+ if (node.body.params.length && (node.body.params.length > 1 || import_compiler39.types.isSpreadElement(node.body.params[0]))) {
9255
9443
  throw tag.get("name").buildCodeFrameError(
9256
9444
  "The [`<await>` tag](https://markojs.com/docs/reference/core-tag#await) only supports a single parameter."
9257
9445
  );
@@ -9288,13 +9476,13 @@ var await_default = {
9288
9476
  flushInto(tag);
9289
9477
  writeHTMLResumeStatements(tagBody);
9290
9478
  tag.replaceWith(
9291
- import_compiler36.types.expressionStatement(
9479
+ import_compiler39.types.expressionStatement(
9292
9480
  callRuntime(
9293
9481
  "_await",
9294
9482
  getScopeIdIdentifier(section),
9295
9483
  getScopeAccessorLiteral(nodeRef),
9296
9484
  valueAttr.value,
9297
- import_compiler36.types.arrowFunctionExpression(
9485
+ import_compiler39.types.arrowFunctionExpression(
9298
9486
  node.body.params,
9299
9487
  toFirstExpressionOrBlock(node.body.body)
9300
9488
  ),
@@ -9328,9 +9516,9 @@ var await_default = {
9328
9516
  const branchRenderArgs = getBranchRendererArgs(bodySection);
9329
9517
  const branchParams = branchRenderArgs.pop();
9330
9518
  (signal.prependStatements ||= []).push(
9331
- import_compiler36.types.variableDeclaration("const", [
9332
- import_compiler36.types.variableDeclarator(
9333
- import_compiler36.types.identifier(bodySection.name),
9519
+ import_compiler39.types.variableDeclaration("const", [
9520
+ import_compiler39.types.variableDeclarator(
9521
+ import_compiler39.types.identifier(bodySection.name),
9334
9522
  callRuntime(
9335
9523
  "_await_content",
9336
9524
  getScopeAccessorLiteral(nodeRef, true),
@@ -9349,8 +9537,8 @@ var await_default = {
9349
9537
  "render",
9350
9538
  section,
9351
9539
  void 0,
9352
- import_compiler36.types.expressionStatement(
9353
- import_compiler36.types.callExpression(import_compiler36.types.identifier(bodySection.name), [scopeIdentifier])
9540
+ import_compiler39.types.expressionStatement(
9541
+ import_compiler39.types.callExpression(import_compiler39.types.identifier(bodySection.name), [scopeIdentifier])
9354
9542
  )
9355
9543
  );
9356
9544
  addValue(
@@ -9374,8 +9562,8 @@ var await_default = {
9374
9562
  };
9375
9563
 
9376
9564
  // src/translator/core/client.ts
9377
- var import_compiler37 = require("@marko/compiler");
9378
- var import_babel_utils27 = require("@marko/compiler/babel-utils");
9565
+ var import_compiler40 = require("@marko/compiler");
9566
+ var import_babel_utils28 = require("@marko/compiler/babel-utils");
9379
9567
  var client_default = {
9380
9568
  parse(tag) {
9381
9569
  const {
@@ -9385,11 +9573,11 @@ var client_default = {
9385
9573
  const rawValue = node.rawValue;
9386
9574
  const code = rawValue.replace(/^client\s*/, "");
9387
9575
  const start = node.start + (rawValue.length - code.length);
9388
- let body = (0, import_babel_utils27.parseStatements)(file, code, start, start + code.length);
9389
- if (body.length === 1 && import_compiler37.types.isBlockStatement(body[0])) {
9576
+ let body = (0, import_babel_utils28.parseStatements)(file, code, start, start + code.length);
9577
+ if (body.length === 1 && import_compiler40.types.isBlockStatement(body[0])) {
9390
9578
  body = body[0].body;
9391
9579
  }
9392
- tag.replaceWith(import_compiler37.types.markoScriptlet(body, true, "client"));
9580
+ tag.replaceWith(import_compiler40.types.markoScriptlet(body, true, "client"));
9393
9581
  },
9394
9582
  parseOptions: {
9395
9583
  statement: true,
@@ -9405,12 +9593,12 @@ var client_default = {
9405
9593
  };
9406
9594
 
9407
9595
  // src/translator/core/const.ts
9408
- var import_compiler38 = require("@marko/compiler");
9409
- var import_babel_utils28 = require("@marko/compiler/babel-utils");
9596
+ var import_compiler41 = require("@marko/compiler");
9597
+ var import_babel_utils29 = require("@marko/compiler/babel-utils");
9410
9598
  var const_default = {
9411
9599
  analyze(tag) {
9412
- (0, import_babel_utils28.assertNoArgs)(tag);
9413
- (0, import_babel_utils28.assertNoParams)(tag);
9600
+ (0, import_babel_utils29.assertNoArgs)(tag);
9601
+ (0, import_babel_utils29.assertNoParams)(tag);
9414
9602
  assertNoBodyContent(tag);
9415
9603
  const { node } = tag;
9416
9604
  const [valueAttr] = node.attributes;
@@ -9424,13 +9612,13 @@ var const_default = {
9424
9612
  "The [`<const>` tag](https://markojs.com/docs/reference/core-tag#const) requires a [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
9425
9613
  );
9426
9614
  }
9427
- if (node.attributes.length > 1 || !import_compiler38.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
9615
+ if (node.attributes.length > 1 || !import_compiler41.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
9428
9616
  throw tag.get("name").buildCodeFrameError(
9429
9617
  "The [`<const>` tag](https://markojs.com/docs/reference/core-tag#const) only supports the [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
9430
9618
  );
9431
9619
  }
9432
9620
  const valueExtra = evaluate(valueAttr.value);
9433
- const upstreamAlias = import_compiler38.types.isIdentifier(valueAttr.value) ? tag.scope.getBinding(valueAttr.value.name)?.identifier.extra?.binding : void 0;
9621
+ const upstreamAlias = import_compiler41.types.isIdentifier(valueAttr.value) ? tag.scope.getBinding(valueAttr.value.name)?.identifier.extra?.binding : void 0;
9434
9622
  if (upstreamAlias) {
9435
9623
  valueExtra.pruned = true;
9436
9624
  }
@@ -9486,16 +9674,16 @@ var const_default = {
9486
9674
  };
9487
9675
 
9488
9676
  // src/translator/core/debug.ts
9489
- var import_compiler39 = require("@marko/compiler");
9490
- var import_babel_utils29 = require("@marko/compiler/babel-utils");
9677
+ var import_compiler42 = require("@marko/compiler");
9678
+ var import_babel_utils30 = require("@marko/compiler/babel-utils");
9491
9679
  var debug_default = {
9492
9680
  analyze(tag) {
9493
9681
  const [valueAttr] = tag.node.attributes;
9494
- (0, import_babel_utils29.assertNoVar)(tag);
9495
- (0, import_babel_utils29.assertNoArgs)(tag);
9496
- (0, import_babel_utils29.assertNoParams)(tag);
9682
+ (0, import_babel_utils30.assertNoVar)(tag);
9683
+ (0, import_babel_utils30.assertNoArgs)(tag);
9684
+ (0, import_babel_utils30.assertNoParams)(tag);
9497
9685
  assertNoBodyContent(tag);
9498
- if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler39.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
9686
+ if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler42.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
9499
9687
  throw tag.get("name").buildCodeFrameError(
9500
9688
  "The [`<debug>` tag](https://markojs.com/docs/reference/core-tag#debug) only supports the [`value=` attribute](https://markojs.com/docs/reference/language#shorthand-value)."
9501
9689
  );
@@ -9506,7 +9694,7 @@ var debug_default = {
9506
9694
  const section = getSection(tag);
9507
9695
  const [valueAttr] = tag.node.attributes;
9508
9696
  const referencedBindings = valueAttr?.value.extra?.referencedBindings;
9509
- const statement = withPreviousLocation(import_compiler39.types.debuggerStatement(), tag.node);
9697
+ const statement = withPreviousLocation(import_compiler42.types.debuggerStatement(), tag.node);
9510
9698
  if (isOutputHTML()) {
9511
9699
  tag.insertBefore(statement);
9512
9700
  } else {
@@ -9529,11 +9717,11 @@ var debug_default = {
9529
9717
  };
9530
9718
 
9531
9719
  // src/translator/core/define.ts
9532
- var import_compiler40 = require("@marko/compiler");
9533
- var import_babel_utils30 = require("@marko/compiler/babel-utils");
9720
+ var import_compiler43 = require("@marko/compiler");
9721
+ var import_babel_utils31 = require("@marko/compiler/babel-utils");
9534
9722
  var define_default = {
9535
9723
  analyze(tag) {
9536
- (0, import_babel_utils30.assertNoArgs)(tag);
9724
+ (0, import_babel_utils31.assertNoArgs)(tag);
9537
9725
  if (!tag.node.var) {
9538
9726
  throw tag.get("name").buildCodeFrameError(
9539
9727
  "The [`<define>` tag](https://markojs.com/docs/reference/core-tag#define) requires a [tag variable](https://markojs.com/docs/reference/language#tag-variables)."
@@ -9549,7 +9737,7 @@ var define_default = {
9549
9737
  trackParamsReferences(tagBody, 3 /* param */);
9550
9738
  setTagDownstream(tag, varBinding);
9551
9739
  if (bodySection) {
9552
- if (import_compiler40.types.isIdentifier(tag.node.var)) {
9740
+ if (import_compiler43.types.isIdentifier(tag.node.var)) {
9553
9741
  const babelBinding = tag.scope.getBinding(tag.node.var.name);
9554
9742
  let allDirectReferences = true;
9555
9743
  for (const ref of babelBinding.referencePaths) {
@@ -9598,7 +9786,7 @@ var define_default = {
9598
9786
  tag.insertBefore(translatedAttrs.statements);
9599
9787
  translateVar(tag, propsToExpression(translatedAttrs.properties));
9600
9788
  } else {
9601
- if (import_compiler40.types.isIdentifier(node.var)) {
9789
+ if (import_compiler43.types.isIdentifier(node.var)) {
9602
9790
  const babelBinding = tag.scope.getBinding(node.var.name);
9603
9791
  let hasDirectReferences = false;
9604
9792
  let allDirectReferences = true;
@@ -9653,24 +9841,24 @@ var define_default = {
9653
9841
  };
9654
9842
 
9655
9843
  // src/translator/core/effect.ts
9656
- var import_compiler41 = require("@marko/compiler");
9657
- var import_babel_utils31 = require("@marko/compiler/babel-utils");
9844
+ var import_compiler44 = require("@marko/compiler");
9845
+ var import_babel_utils32 = require("@marko/compiler/babel-utils");
9658
9846
  var effect_default = {
9659
9847
  migrate: [
9660
9848
  (tag) => {
9661
- (0, import_babel_utils31.assertNoArgs)(tag);
9662
- (0, import_babel_utils31.assertNoParams)(tag);
9849
+ (0, import_babel_utils32.assertNoArgs)(tag);
9850
+ (0, import_babel_utils32.assertNoParams)(tag);
9663
9851
  assertNoBodyContent(tag);
9664
- (0, import_babel_utils31.assertNoAttributeTags)(tag);
9852
+ (0, import_babel_utils32.assertNoAttributeTags)(tag);
9665
9853
  assertNoSpreadAttrs(tag);
9666
- (0, import_babel_utils31.assertAllowedAttributes)(tag, ["value"]);
9667
- (0, import_babel_utils31.diagnosticDeprecate)(tag, {
9854
+ (0, import_babel_utils32.assertAllowedAttributes)(tag, ["value"]);
9855
+ (0, import_babel_utils32.diagnosticDeprecate)(tag, {
9668
9856
  label: "The 'effect' tag has been replaced by the 'script' tag.",
9669
9857
  fix() {
9670
9858
  const { node } = tag;
9671
9859
  tag.replaceWith(
9672
- import_compiler41.types.markoTag(
9673
- withPreviousLocation(import_compiler41.types.stringLiteral("script"), node.name),
9860
+ import_compiler44.types.markoTag(
9861
+ withPreviousLocation(import_compiler44.types.stringLiteral("script"), node.name),
9674
9862
  node.attributes,
9675
9863
  node.body,
9676
9864
  node.arguments,
@@ -9687,12 +9875,12 @@ var effect_default = {
9687
9875
  };
9688
9876
 
9689
9877
  // src/translator/core/export.ts
9690
- var import_babel_utils32 = require("@marko/compiler/babel-utils");
9878
+ var import_babel_utils33 = require("@marko/compiler/babel-utils");
9691
9879
  var export_default = {
9692
9880
  parse(tag) {
9693
9881
  const { node } = tag;
9694
9882
  tag.replaceWith(
9695
- (0, import_babel_utils32.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
9883
+ (0, import_babel_utils33.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
9696
9884
  );
9697
9885
  },
9698
9886
  parseOptions: {
@@ -9707,55 +9895,18 @@ var export_default = {
9707
9895
  };
9708
9896
 
9709
9897
  // src/translator/core/html-comment.ts
9710
- var import_compiler43 = require("@marko/compiler");
9711
- var import_babel_utils33 = require("@marko/compiler/babel-utils");
9712
-
9713
- // src/translator/util/body-to-text-literal.ts
9714
- var import_compiler42 = require("@marko/compiler");
9715
- function bodyToTextLiteral(body) {
9716
- const templateQuasis = [];
9717
- const templateExpressions = [];
9718
- let currentQuasi = "";
9719
- let placeholderExtra;
9720
- for (const child of body.body) {
9721
- if (import_compiler42.types.isMarkoText(child)) {
9722
- currentQuasi += child.value;
9723
- } else if (import_compiler42.types.isMarkoPlaceholder(child)) {
9724
- placeholderExtra ||= child.value.extra;
9725
- templateQuasis.push(templateElement(currentQuasi, false));
9726
- templateExpressions.push(callRuntime("_to_text", child.value));
9727
- currentQuasi = "";
9728
- }
9729
- }
9730
- if (templateExpressions.length) {
9731
- templateQuasis.push(templateElement(currentQuasi, true));
9732
- const literal = import_compiler42.types.templateLiteral(templateQuasis, templateExpressions);
9733
- literal.extra = placeholderExtra;
9734
- return literal;
9735
- }
9736
- return import_compiler42.types.stringLiteral(currentQuasi);
9737
- }
9738
- function templateElement(value, tail) {
9739
- return import_compiler42.types.templateElement(
9740
- {
9741
- raw: value.replace(/`/g, "\\`"),
9742
- cooked: value
9743
- },
9744
- tail
9745
- );
9746
- }
9747
-
9748
- // src/translator/core/html-comment.ts
9898
+ var import_compiler45 = require("@marko/compiler");
9899
+ var import_babel_utils34 = require("@marko/compiler/babel-utils");
9749
9900
  var kNodeBinding = Symbol("comment tag binding");
9750
9901
  var html_comment_default = {
9751
9902
  analyze(tag) {
9752
- (0, import_babel_utils33.assertNoArgs)(tag);
9753
- (0, import_babel_utils33.assertNoParams)(tag);
9754
- (0, import_babel_utils33.assertNoAttributes)(tag);
9903
+ (0, import_babel_utils34.assertNoArgs)(tag);
9904
+ (0, import_babel_utils34.assertNoParams)(tag);
9905
+ (0, import_babel_utils34.assertNoAttributes)(tag);
9755
9906
  const tagVar = tag.node.var;
9756
9907
  let needsBinding = false;
9757
9908
  if (tagVar) {
9758
- if (!import_compiler43.types.isIdentifier(tagVar)) {
9909
+ if (!import_compiler45.types.isIdentifier(tagVar)) {
9759
9910
  throw tag.get("var").buildCodeFrameError(
9760
9911
  "The [`<html-comment>` tag](https://markojs.com/docs/reference/core-tag#html-comment) tag variable cannot be destructured."
9761
9912
  );
@@ -9772,693 +9923,44 @@ var html_comment_default = {
9772
9923
  "Invalid child. Only text is allowed inside an html comment."
9773
9924
  );
9774
9925
  }
9775
- }
9776
- if (needsBinding) {
9777
- const tagSection = getOrCreateSection(tag);
9778
- const tagExtra = mergeReferences(tagSection, tag.node, referenceNodes);
9779
- const nodeBinding = tagExtra[kNodeBinding] = createBinding(
9780
- "#comment",
9781
- 0 /* dom */,
9782
- tagSection
9783
- );
9784
- trackDomVarReferences(tag, nodeBinding);
9785
- addSerializeExpr(tagSection, !!tagVar || tagExtra, nodeBinding);
9786
- }
9787
- tag.skip();
9788
- },
9789
- translate: {
9790
- enter(tag) {
9791
- const tagExtra = tag.node.extra;
9792
- const nodeBinding = tagExtra[kNodeBinding];
9793
- if (isOutputHTML()) {
9794
- translateDomVar(tag, nodeBinding);
9795
- }
9796
- if (nodeBinding) {
9797
- visit(tag, 32 /* Get */);
9798
- }
9799
- enter2(tag);
9800
- writeTo(tag)`<!--`;
9801
- },
9802
- exit(tag) {
9803
- const tagSection = getSection(tag);
9804
- const tagExtra = tag.node.extra;
9805
- const nodeBinding = tagExtra[kNodeBinding];
9806
- const write = writeTo(tag);
9807
- if (isOutputHTML()) {
9808
- for (const child of tag.node.body.body) {
9809
- if (import_compiler43.types.isMarkoText(child)) {
9810
- write`${child.value}`;
9811
- } else if (import_compiler43.types.isMarkoPlaceholder(child)) {
9812
- write`${callRuntime("_to_text", child.value)}`;
9813
- }
9814
- }
9815
- } else {
9816
- const textLiteral = bodyToTextLiteral(tag.node.body);
9817
- if (import_compiler43.types.isStringLiteral(textLiteral)) {
9818
- write`${textLiteral}`;
9819
- } else {
9820
- addStatement(
9821
- "render",
9822
- getSection(tag),
9823
- tagExtra.referencedBindings,
9824
- import_compiler43.types.expressionStatement(
9825
- callRuntime(
9826
- "_text",
9827
- createScopeReadExpression(nodeBinding),
9828
- textLiteral
9829
- )
9830
- )
9831
- );
9832
- }
9833
- }
9834
- exit2(tag);
9835
- write`-->`;
9836
- if (nodeBinding) {
9837
- markNode(
9838
- tag,
9839
- nodeBinding,
9840
- getSerializeReason(tagSection, nodeBinding)
9841
- );
9842
- }
9843
- tag.remove();
9844
- }
9845
- },
9846
- parseOptions: {
9847
- text: true
9848
- },
9849
- attributes: {},
9850
- autocomplete: [
9851
- {
9852
- description: "Use to create an html comment that is not stripped from the output.",
9853
- descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#html-comment"
9854
- }
9855
- ]
9856
- };
9857
-
9858
- // src/translator/core/html-script.ts
9859
- var import_compiler44 = require("@marko/compiler");
9860
- var import_babel_utils34 = require("@marko/compiler/babel-utils");
9861
- var kNodeBinding2 = Symbol("script tag node binding");
9862
- var html_script_default = {
9863
- analyze(tag) {
9864
- (0, import_babel_utils34.assertNoArgs)(tag);
9865
- (0, import_babel_utils34.assertNoParams)(tag);
9866
- const { node } = tag;
9867
- if (node.var && !import_compiler44.types.isIdentifier(node.var)) {
9868
- throw tag.get("var").buildCodeFrameError(
9869
- "Tag variables on native elements cannot be destructured."
9870
- );
9871
- }
9872
- const seen = {};
9873
- const { attributes } = tag.node;
9874
- let spreadReferenceNodes;
9875
- let exprExtras;
9876
- let hasEventHandlers = false;
9877
- let hasDynamicAttributes = false;
9878
- for (let i = attributes.length; i--; ) {
9879
- const attr = attributes[i];
9880
- const valueExtra = attr.value.extra ??= {};
9881
- if (import_compiler44.types.isMarkoAttribute(attr)) {
9882
- if (seen[attr.name]) {
9883
- dropReferences(attr.value);
9884
- continue;
9885
- }
9886
- seen[attr.name] = attr;
9887
- if (isEventHandler(attr.name)) {
9888
- valueExtra.isEffect = true;
9889
- hasEventHandlers = true;
9890
- } else if (!evaluate(attr.value).confident) {
9891
- hasDynamicAttributes = true;
9892
- }
9893
- } else if (import_compiler44.types.isMarkoSpreadAttribute(attr)) {
9894
- valueExtra.isEffect = true;
9895
- hasEventHandlers = true;
9896
- hasDynamicAttributes = true;
9897
- }
9898
- if (spreadReferenceNodes) {
9899
- spreadReferenceNodes.push(attr.value);
9900
- } else if (import_compiler44.types.isMarkoSpreadAttribute(attr)) {
9901
- spreadReferenceNodes = [attr.value];
9902
- } else {
9903
- exprExtras = push(exprExtras, valueExtra);
9904
- }
9905
- }
9906
- const bodyPlaceholderNodes = [];
9907
- let hasBodyPlaceholders = false;
9908
- for (const child of tag.node.body.body) {
9909
- if (import_compiler44.types.isMarkoPlaceholder(child)) {
9910
- bodyPlaceholderNodes.push(child.value);
9911
- hasBodyPlaceholders = true;
9912
- } else if (!import_compiler44.types.isMarkoText(child)) {
9913
- throw tag.hub.buildError(
9914
- child,
9915
- "Invalid child. Only text is allowed inside an html-script."
9916
- );
9917
- }
9918
- }
9919
- if (node.var || hasEventHandlers || hasDynamicAttributes || hasBodyPlaceholders) {
9920
- const tagExtra = node.extra ??= {};
9921
- const tagSection = getOrCreateSection(tag);
9922
- const nodeBinding = tagExtra[kNodeBinding2] = createBinding(
9923
- "#script",
9924
- 0 /* dom */,
9925
- tagSection
9926
- );
9927
- if (hasEventHandlers) {
9928
- (0, import_babel_utils34.getProgram)().node.extra.isInteractive = true;
9929
- }
9930
- if (spreadReferenceNodes) {
9931
- mergeReferences(tagSection, tag.node, spreadReferenceNodes);
9932
- }
9933
- if (hasBodyPlaceholders) {
9934
- exprExtras = push(
9935
- exprExtras,
9936
- bodyPlaceholderNodes.length === 1 ? bodyPlaceholderNodes[0].extra ??= {} : mergeReferences(
9937
- tagSection,
9938
- bodyPlaceholderNodes[0],
9939
- bodyPlaceholderNodes.slice(1)
9940
- )
9941
- );
9942
- }
9943
- trackDomVarReferences(tag, nodeBinding);
9944
- addSerializeExpr(
9945
- tagSection,
9946
- !!(node.var || hasEventHandlers),
9947
- nodeBinding
9948
- );
9949
- addSerializeExpr(tagSection, push(exprExtras, tagExtra), nodeBinding);
9950
- }
9951
- },
9952
- translate: {
9953
- enter(tag) {
9954
- const tagExtra = tag.node.extra;
9955
- const nodeBinding = tagExtra[kNodeBinding2];
9956
- const isHTML = isOutputHTML();
9957
- const write = writeTo(tag);
9958
- const tagSection = getSection(tag);
9959
- if (isHTML) {
9960
- translateDomVar(tag, nodeBinding);
9961
- }
9962
- if (nodeBinding) {
9963
- visit(tag, 32 /* Get */);
9964
- }
9965
- write`<script`;
9966
- const usedAttrs = getUsedAttrs2(tag.node, isHTML);
9967
- const { hasNonce, staticAttrs, skipExpression, spreadExpression } = usedAttrs;
9968
- if (isHTML && !hasNonce && !spreadExpression) {
9969
- write`${callRuntime("_attr_nonce")}`;
9970
- }
9971
- for (const attr of staticAttrs) {
9972
- const { name: name2, value } = attr;
9973
- const { confident, computed } = value.extra || {};
9974
- const valueReferences = value.extra?.referencedBindings;
9975
- switch (name2) {
9976
- case "class":
9977
- case "style": {
9978
- const helper = `_attr_${name2}`;
9979
- if (confident) {
9980
- write`${getHTMLRuntime()[helper](computed)}`;
9981
- } else if (isHTML) {
9982
- write`${callRuntime(helper, value)}`;
9983
- } else {
9984
- addStatement(
9985
- "render",
9986
- tagSection,
9987
- valueReferences,
9988
- import_compiler44.types.expressionStatement(
9989
- callRuntime(
9990
- helper,
9991
- createScopeReadExpression(nodeBinding),
9992
- value
9993
- )
9994
- )
9995
- );
9996
- }
9997
- break;
9998
- }
9999
- default:
10000
- if (confident) {
10001
- write`${getHTMLRuntime()._attr(name2, computed)}`;
10002
- } else if (isHTML) {
10003
- if (isEventHandler(name2)) {
10004
- addHTMLEffectCall(tagSection, valueReferences);
10005
- } else {
10006
- write`${callRuntime("_attr", import_compiler44.types.stringLiteral(name2), value)}`;
10007
- }
10008
- } else if (isEventHandler(name2)) {
10009
- addStatement(
10010
- "effect",
10011
- tagSection,
10012
- valueReferences,
10013
- import_compiler44.types.expressionStatement(
10014
- callRuntime(
10015
- "_on",
10016
- createScopeReadExpression(nodeBinding),
10017
- import_compiler44.types.stringLiteral(getEventHandlerName(name2)),
10018
- value
10019
- )
10020
- )
10021
- );
10022
- } else {
10023
- addStatement(
10024
- "render",
10025
- tagSection,
10026
- valueReferences,
10027
- import_compiler44.types.expressionStatement(
10028
- callRuntime(
10029
- "_attr",
10030
- createScopeReadExpression(nodeBinding),
10031
- import_compiler44.types.stringLiteral(name2),
10032
- value
10033
- )
10034
- )
10035
- );
10036
- }
10037
- break;
10038
- }
10039
- }
10040
- if (spreadExpression) {
10041
- const visitAccessor = getScopeAccessorLiteral(nodeBinding);
10042
- if (isHTML) {
10043
- addHTMLEffectCall(tagSection, tagExtra.referencedBindings);
10044
- if (skipExpression) {
10045
- write`${callRuntime("_attrs_partial", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler44.types.stringLiteral("script"))}`;
10046
- } else {
10047
- write`${callRuntime("_attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler44.types.stringLiteral("script"))}`;
10048
- }
10049
- } else {
10050
- if (skipExpression) {
10051
- addStatement(
10052
- "render",
10053
- tagSection,
10054
- tagExtra.referencedBindings,
10055
- import_compiler44.types.expressionStatement(
10056
- callRuntime(
10057
- "_attrs_partial",
10058
- scopeIdentifier,
10059
- visitAccessor,
10060
- spreadExpression,
10061
- skipExpression
10062
- )
10063
- )
10064
- );
10065
- } else {
10066
- addStatement(
10067
- "render",
10068
- tagSection,
10069
- tagExtra.referencedBindings,
10070
- import_compiler44.types.expressionStatement(
10071
- callRuntime(
10072
- "_attrs",
10073
- scopeIdentifier,
10074
- visitAccessor,
10075
- spreadExpression
10076
- )
10077
- )
10078
- );
10079
- }
10080
- addStatement(
10081
- "effect",
10082
- tagSection,
10083
- tagExtra.referencedBindings,
10084
- import_compiler44.types.expressionStatement(
10085
- callRuntime("_attrs_script", scopeIdentifier, visitAccessor)
10086
- ),
10087
- false
10088
- );
10089
- }
10090
- }
10091
- write`>`;
10092
- enter2(tag);
10093
- },
10094
- exit(tag) {
10095
- const tagSection = getSection(tag);
10096
- const tagExtra = tag.node.extra;
10097
- const nodeBinding = tagExtra[kNodeBinding2];
10098
- const write = writeTo(tag);
10099
- if (isOutputHTML()) {
10100
- for (const child of tag.node.body.body) {
10101
- if (import_compiler44.types.isMarkoText(child)) {
10102
- write`${child.value}`;
10103
- } else if (import_compiler44.types.isMarkoPlaceholder(child)) {
10104
- write`${callRuntime("_escape_script", child.value)}`;
10105
- }
10106
- }
10107
- } else {
10108
- const textLiteral = bodyToTextLiteral(tag.node.body);
10109
- if (import_compiler44.types.isStringLiteral(textLiteral)) {
10110
- write`${textLiteral}`;
10111
- } else {
10112
- addStatement(
10113
- "render",
10114
- getSection(tag),
10115
- textLiteral.extra?.referencedBindings,
10116
- import_compiler44.types.expressionStatement(
10117
- callRuntime(
10118
- "_text_content",
10119
- createScopeReadExpression(nodeBinding),
10120
- textLiteral
10121
- )
10122
- )
10123
- );
10124
- }
10125
- }
10126
- write`</script>`;
10127
- if (nodeBinding) {
10128
- markNode(
10129
- tag,
10130
- nodeBinding,
10131
- getSerializeReason(tagSection, nodeBinding)
10132
- );
10133
- }
10134
- exit2(tag);
10135
- tag.remove();
10136
- }
10137
- },
10138
- "@async": "#html-async",
10139
- "@crossorigin": "#html-crossorigin",
10140
- "@defer": "#html-defer",
10141
- "@integrity": "#html-integrity",
10142
- "@nomodule": "#html-nomodule",
10143
- "@nonce": "#html-nonce",
10144
- "@referrerpolicy": "#html-referrerpolicy",
10145
- "@src": "#html-src",
10146
- "@type": "#html-type",
10147
- "attribute-groups": ["html-attributes"],
10148
- parseOptions: {
10149
- text: true,
10150
- preserveWhitespace: true
10151
- },
10152
- autocomplete: [
10153
- {
10154
- description: "Use instead of `<script>` to render a native tag directly, without processing by Marko.",
10155
- descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#html-script--html-style"
10156
- }
10157
- ]
10158
- };
10159
- function getUsedAttrs2(tag, injectNonce) {
10160
- const seen = {};
10161
- const { attributes } = tag;
10162
- const maybeStaticAttrs = /* @__PURE__ */ new Set();
10163
- let spreadExpression;
10164
- let skipExpression;
10165
- let spreadProps;
10166
- let skipProps;
10167
- let hasNonce = false;
10168
- for (let i = attributes.length; i--; ) {
10169
- const attr = attributes[i];
10170
- const { value } = attr;
10171
- if (import_compiler44.types.isMarkoSpreadAttribute(attr)) {
10172
- if (!spreadProps) {
10173
- spreadProps = [];
10174
- }
10175
- spreadProps.push(import_compiler44.types.spreadElement(value));
10176
- } else if (!seen[attr.name]) {
10177
- seen[attr.name] = attr;
10178
- if (attr.name === "nonce") {
10179
- hasNonce = true;
10180
- }
10181
- if (spreadProps) {
10182
- spreadProps.push(toObjectProperty(attr.name, attr.value));
10183
- } else {
10184
- maybeStaticAttrs.add(attr);
10185
- }
10186
- }
10187
- }
10188
- const staticAttrs = [...maybeStaticAttrs].reverse();
10189
- if (spreadProps) {
10190
- spreadProps.reverse();
10191
- for (const { name: name2 } of staticAttrs) {
10192
- (skipProps ||= []).push(toObjectProperty(name2, import_compiler44.types.numericLiteral(1)));
10193
- }
10194
- if (skipProps) {
10195
- skipExpression = import_compiler44.types.objectExpression(skipProps);
10196
- }
10197
- if (injectNonce && !hasNonce) {
10198
- spreadProps.unshift(
10199
- import_compiler44.types.objectProperty(
10200
- import_compiler44.types.identifier("nonce"),
10201
- import_compiler44.types.memberExpression(callRuntime("$global"), import_compiler44.types.identifier("cspNonce"))
10202
- )
10203
- );
10204
- }
10205
- spreadExpression = propsToExpression(spreadProps);
10206
- }
10207
- return {
10208
- hasNonce,
10209
- staticAttrs,
10210
- spreadExpression,
10211
- skipExpression
10212
- };
10213
- }
10214
-
10215
- // src/translator/core/html-style.ts
10216
- var import_compiler45 = require("@marko/compiler");
10217
- var import_babel_utils35 = require("@marko/compiler/babel-utils");
10218
- var kNodeBinding3 = Symbol("style tag node binding");
10219
- var html_style_default = {
10220
- analyze(tag) {
10221
- (0, import_babel_utils35.assertNoArgs)(tag);
10222
- (0, import_babel_utils35.assertNoParams)(tag);
10223
- const { node } = tag;
10224
- if (node.var && !import_compiler45.types.isIdentifier(node.var)) {
10225
- throw tag.get("var").buildCodeFrameError(
10226
- "Tag variables on native elements cannot be destructured."
10227
- );
10228
- }
10229
- const seen = {};
10230
- const { attributes } = tag.node;
10231
- let spreadReferenceNodes;
10232
- let exprExtras;
10233
- let hasEventHandlers = false;
10234
- let hasDynamicAttributes = false;
10235
- for (let i = attributes.length; i--; ) {
10236
- const attr = attributes[i];
10237
- const valueExtra = attr.value.extra ??= {};
10238
- if (import_compiler45.types.isMarkoAttribute(attr)) {
10239
- if (seen[attr.name]) {
10240
- dropReferences(attr.value);
10241
- continue;
10242
- }
10243
- seen[attr.name] = attr;
10244
- if (isEventHandler(attr.name)) {
10245
- valueExtra.isEffect = true;
10246
- hasEventHandlers = true;
10247
- } else if (!evaluate(attr.value).confident) {
10248
- hasDynamicAttributes = true;
10249
- }
10250
- } else if (import_compiler45.types.isMarkoSpreadAttribute(attr)) {
10251
- valueExtra.isEffect = true;
10252
- hasEventHandlers = true;
10253
- hasDynamicAttributes = true;
10254
- }
10255
- if (spreadReferenceNodes) {
10256
- spreadReferenceNodes.push(attr.value);
10257
- } else if (import_compiler45.types.isMarkoSpreadAttribute(attr)) {
10258
- spreadReferenceNodes = [attr.value];
10259
- } else {
10260
- exprExtras = push(exprExtras, valueExtra);
10261
- }
10262
- }
10263
- const bodyPlaceholderNodes = [];
10264
- let hasBodyPlaceholders = false;
10265
- for (const child of tag.node.body.body) {
10266
- if (import_compiler45.types.isMarkoPlaceholder(child)) {
10267
- bodyPlaceholderNodes.push(child.value);
10268
- hasBodyPlaceholders = true;
10269
- } else if (!import_compiler45.types.isMarkoText(child)) {
10270
- throw tag.hub.buildError(
10271
- child,
10272
- "Invalid child. Only text is allowed inside an html-style."
10273
- );
10274
- }
10275
- }
10276
- if (node.var || hasEventHandlers || hasDynamicAttributes || hasBodyPlaceholders) {
10277
- const tagExtra = node.extra ??= {};
10278
- const tagSection = getOrCreateSection(tag);
10279
- const nodeBinding = tagExtra[kNodeBinding3] = createBinding(
10280
- "#style",
10281
- 0 /* dom */,
10282
- tagSection
10283
- );
10284
- if (hasEventHandlers) {
10285
- (0, import_babel_utils35.getProgram)().node.extra.isInteractive = true;
10286
- }
10287
- if (spreadReferenceNodes) {
10288
- mergeReferences(tagSection, tag.node, spreadReferenceNodes);
10289
- }
10290
- if (hasBodyPlaceholders) {
10291
- exprExtras = push(
10292
- exprExtras,
10293
- bodyPlaceholderNodes.length === 1 ? bodyPlaceholderNodes[0].extra ??= {} : mergeReferences(
10294
- tagSection,
10295
- bodyPlaceholderNodes[0],
10296
- bodyPlaceholderNodes.slice(1)
10297
- )
10298
- );
10299
- }
10300
- trackDomVarReferences(tag, nodeBinding);
10301
- addSerializeExpr(
10302
- tagSection,
10303
- !!(node.var || hasEventHandlers),
10304
- nodeBinding
10305
- );
10306
- addSerializeExpr(tagSection, push(exprExtras, tagExtra), nodeBinding);
10307
- }
10308
- },
10309
- translate: {
10310
- enter(tag) {
10311
- const tagExtra = tag.node.extra;
10312
- const nodeBinding = tagExtra[kNodeBinding3];
10313
- const isHTML = isOutputHTML();
10314
- const write = writeTo(tag);
10315
- const tagSection = getSection(tag);
10316
- if (isHTML) {
10317
- translateDomVar(tag, nodeBinding);
10318
- }
10319
- if (nodeBinding) {
10320
- visit(tag, 32 /* Get */);
10321
- }
10322
- write`<style`;
10323
- const usedAttrs = getUsedAttrs3(tag.node, isHTML);
10324
- const { hasNonce, staticAttrs, skipExpression, spreadExpression } = usedAttrs;
10325
- if (isHTML && !hasNonce && !spreadExpression) {
10326
- write`${callRuntime("_attr_nonce")}`;
10327
- }
10328
- for (const attr of staticAttrs) {
10329
- const { name: name2, value } = attr;
10330
- const { confident, computed } = value.extra || {};
10331
- const valueReferences = value.extra?.referencedBindings;
10332
- switch (name2) {
10333
- case "class":
10334
- case "style": {
10335
- const helper = `_attr_${name2}`;
10336
- if (confident) {
10337
- write`${getHTMLRuntime()[helper](computed)}`;
10338
- } else if (isHTML) {
10339
- write`${callRuntime(helper, value)}`;
10340
- } else {
10341
- addStatement(
10342
- "render",
10343
- tagSection,
10344
- valueReferences,
10345
- import_compiler45.types.expressionStatement(
10346
- callRuntime(
10347
- helper,
10348
- createScopeReadExpression(nodeBinding),
10349
- value
10350
- )
10351
- )
10352
- );
10353
- }
10354
- break;
10355
- }
10356
- default:
10357
- if (confident) {
10358
- write`${getHTMLRuntime()._attr(name2, computed)}`;
10359
- } else if (isHTML) {
10360
- if (isEventHandler(name2)) {
10361
- addHTMLEffectCall(tagSection, valueReferences);
10362
- } else {
10363
- write`${callRuntime("_attr", import_compiler45.types.stringLiteral(name2), value)}`;
10364
- }
10365
- } else if (isEventHandler(name2)) {
10366
- addStatement(
10367
- "effect",
10368
- tagSection,
10369
- valueReferences,
10370
- import_compiler45.types.expressionStatement(
10371
- callRuntime(
10372
- "_on",
10373
- createScopeReadExpression(nodeBinding),
10374
- import_compiler45.types.stringLiteral(getEventHandlerName(name2)),
10375
- value
10376
- )
10377
- )
10378
- );
10379
- } else {
10380
- addStatement(
10381
- "render",
10382
- tagSection,
10383
- valueReferences,
10384
- import_compiler45.types.expressionStatement(
10385
- callRuntime(
10386
- "_attr",
10387
- createScopeReadExpression(nodeBinding),
10388
- import_compiler45.types.stringLiteral(name2),
10389
- value
10390
- )
10391
- )
10392
- );
10393
- }
10394
- break;
10395
- }
10396
- }
10397
- if (spreadExpression) {
10398
- const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
10399
- if (isHTML) {
10400
- addHTMLEffectCall(tagSection, tagExtra.referencedBindings);
10401
- if (skipExpression) {
10402
- write`${callRuntime("_attrs_partial", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler45.types.stringLiteral("style"))}`;
10403
- } else {
10404
- write`${callRuntime("_attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler45.types.stringLiteral("style"))}`;
10405
- }
10406
- } else {
10407
- if (skipExpression) {
10408
- addStatement(
10409
- "render",
10410
- tagSection,
10411
- tagExtra.referencedBindings,
10412
- import_compiler45.types.expressionStatement(
10413
- callRuntime(
10414
- "_attrs_partial",
10415
- scopeIdentifier,
10416
- visitAccessor,
10417
- spreadExpression,
10418
- skipExpression
10419
- )
10420
- )
10421
- );
10422
- } else {
10423
- addStatement(
10424
- "render",
10425
- tagSection,
10426
- tagExtra.referencedBindings,
10427
- import_compiler45.types.expressionStatement(
10428
- callRuntime(
10429
- "_attrs",
10430
- scopeIdentifier,
10431
- visitAccessor,
10432
- spreadExpression
10433
- )
10434
- )
10435
- );
10436
- }
10437
- addStatement(
10438
- "effect",
10439
- tagSection,
10440
- tagExtra.referencedBindings,
10441
- import_compiler45.types.expressionStatement(
10442
- callRuntime("_attrs_script", scopeIdentifier, visitAccessor)
10443
- ),
10444
- false
10445
- );
10446
- }
9926
+ }
9927
+ if (needsBinding) {
9928
+ const tagSection = getOrCreateSection(tag);
9929
+ const tagExtra = mergeReferences(tagSection, tag.node, referenceNodes);
9930
+ const nodeBinding = tagExtra[kNodeBinding] = createBinding(
9931
+ "#comment",
9932
+ 0 /* dom */,
9933
+ tagSection
9934
+ );
9935
+ trackDomVarReferences(tag, nodeBinding);
9936
+ addSerializeExpr(tagSection, !!tagVar || tagExtra, nodeBinding);
9937
+ }
9938
+ tag.skip();
9939
+ },
9940
+ translate: {
9941
+ enter(tag) {
9942
+ const tagExtra = tag.node.extra;
9943
+ const nodeBinding = tagExtra[kNodeBinding];
9944
+ if (isOutputHTML()) {
9945
+ translateDomVar(tag, nodeBinding);
9946
+ }
9947
+ if (nodeBinding) {
9948
+ visit(tag, 32 /* Get */);
10447
9949
  }
10448
- write`>`;
10449
9950
  enter2(tag);
9951
+ writeTo(tag)`<!--`;
10450
9952
  },
10451
9953
  exit(tag) {
10452
9954
  const tagSection = getSection(tag);
10453
9955
  const tagExtra = tag.node.extra;
10454
- const nodeBinding = tagExtra[kNodeBinding3];
9956
+ const nodeBinding = tagExtra[kNodeBinding];
10455
9957
  const write = writeTo(tag);
10456
9958
  if (isOutputHTML()) {
10457
9959
  for (const child of tag.node.body.body) {
10458
9960
  if (import_compiler45.types.isMarkoText(child)) {
10459
9961
  write`${child.value}`;
10460
9962
  } else if (import_compiler45.types.isMarkoPlaceholder(child)) {
10461
- write`${callRuntime("_escape_style", child.value)}`;
9963
+ write`${callRuntime("_escape_text", child.value)}`;
10462
9964
  }
10463
9965
  }
10464
9966
  } else {
@@ -10469,10 +9971,10 @@ var html_style_default = {
10469
9971
  addStatement(
10470
9972
  "render",
10471
9973
  getSection(tag),
10472
- textLiteral.extra?.referencedBindings,
9974
+ tagExtra.referencedBindings,
10473
9975
  import_compiler45.types.expressionStatement(
10474
9976
  callRuntime(
10475
- "_text_content",
9977
+ "_text",
10476
9978
  createScopeReadExpression(nodeBinding),
10477
9979
  textLiteral
10478
9980
  )
@@ -10480,7 +9982,8 @@ var html_style_default = {
10480
9982
  );
10481
9983
  }
10482
9984
  }
10483
- write`</style>`;
9985
+ exit2(tag);
9986
+ write`-->`;
10484
9987
  if (nodeBinding) {
10485
9988
  markNode(
10486
9989
  tag,
@@ -10488,91 +9991,62 @@ var html_style_default = {
10488
9991
  getSerializeReason(tagSection, nodeBinding)
10489
9992
  );
10490
9993
  }
10491
- exit2(tag);
10492
9994
  tag.remove();
10493
9995
  }
10494
9996
  },
10495
- "@disabled": "#html-disabled",
10496
- "@media": "#html-media",
10497
- "@nonce": "#html-nonce",
10498
- "@type": "#html-type",
10499
- "attribute-groups": ["html-attributes"],
9997
+ parseOptions: {
9998
+ text: true
9999
+ },
10000
+ types: runtime_info_default.name + "/tags/html-comment.d.marko",
10001
+ autocomplete: [
10002
+ {
10003
+ description: "Use to create an html comment that is not stripped from the output.",
10004
+ descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#html-comment"
10005
+ }
10006
+ ]
10007
+ };
10008
+
10009
+ // src/translator/core/html-script.ts
10010
+ var html_script_default = {
10011
+ types: runtime_info_default.name + "/tags/html-script.d.marko",
10012
+ html: true,
10500
10013
  parseOptions: {
10501
10014
  text: true,
10502
10015
  preserveWhitespace: true
10503
10016
  },
10504
10017
  autocomplete: [
10505
10018
  {
10506
- description: "Use instead of `<style>` to render a native tag directly, without processing by Marko.",
10019
+ description: "Use instead of `<script>` to render a native tag directly, without processing by Marko.",
10507
10020
  descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#html-script--html-style"
10508
10021
  }
10509
10022
  ]
10510
10023
  };
10511
- function getUsedAttrs3(tag, injectNonce) {
10512
- const seen = {};
10513
- const { attributes } = tag;
10514
- const maybeStaticAttrs = /* @__PURE__ */ new Set();
10515
- let spreadExpression;
10516
- let skipExpression;
10517
- let spreadProps;
10518
- let skipProps;
10519
- let hasNonce = false;
10520
- for (let i = attributes.length; i--; ) {
10521
- const attr = attributes[i];
10522
- const { value } = attr;
10523
- if (import_compiler45.types.isMarkoSpreadAttribute(attr)) {
10524
- if (!spreadProps) {
10525
- spreadProps = [];
10526
- }
10527
- spreadProps.push(import_compiler45.types.spreadElement(value));
10528
- } else if (!seen[attr.name]) {
10529
- seen[attr.name] = attr;
10530
- if (attr.name === "nonce") {
10531
- hasNonce = true;
10532
- }
10533
- if (spreadProps) {
10534
- spreadProps.push(toObjectProperty(attr.name, attr.value));
10535
- } else {
10536
- maybeStaticAttrs.add(attr);
10537
- }
10538
- }
10539
- }
10540
- const staticAttrs = [...maybeStaticAttrs].reverse();
10541
- if (spreadProps) {
10542
- spreadProps.reverse();
10543
- for (const { name: name2 } of staticAttrs) {
10544
- (skipProps ||= []).push(toObjectProperty(name2, import_compiler45.types.numericLiteral(1)));
10545
- }
10546
- if (skipProps) {
10547
- skipExpression = import_compiler45.types.objectExpression(skipProps);
10548
- }
10549
- if (injectNonce && !hasNonce) {
10550
- spreadProps.unshift(
10551
- import_compiler45.types.objectProperty(
10552
- import_compiler45.types.identifier("nonce"),
10553
- import_compiler45.types.memberExpression(callRuntime("$global"), import_compiler45.types.identifier("cspNonce"))
10554
- )
10555
- );
10024
+
10025
+ // src/translator/core/html-style.ts
10026
+ var html_style_default = {
10027
+ types: runtime_info_default.name + "/tags/html-style.d.marko",
10028
+ html: true,
10029
+ parseOptions: {
10030
+ text: true,
10031
+ preserveWhitespace: true
10032
+ },
10033
+ autocomplete: [
10034
+ {
10035
+ description: "Use instead of `<style>` to render a native tag directly, without processing by Marko.",
10036
+ descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#html-script--html-style"
10556
10037
  }
10557
- spreadExpression = propsToExpression(spreadProps);
10558
- }
10559
- return {
10560
- hasNonce,
10561
- staticAttrs,
10562
- spreadExpression,
10563
- skipExpression
10564
- };
10565
- }
10038
+ ]
10039
+ };
10566
10040
 
10567
10041
  // src/translator/core/id.ts
10568
10042
  var import_compiler46 = require("@marko/compiler");
10569
- var import_babel_utils36 = require("@marko/compiler/babel-utils");
10043
+ var import_babel_utils35 = require("@marko/compiler/babel-utils");
10570
10044
  var id_default = {
10571
10045
  analyze(tag) {
10572
- (0, import_babel_utils36.assertNoArgs)(tag);
10573
- (0, import_babel_utils36.assertNoParams)(tag);
10046
+ (0, import_babel_utils35.assertNoArgs)(tag);
10047
+ (0, import_babel_utils35.assertNoParams)(tag);
10574
10048
  assertNoBodyContent(tag);
10575
- (0, import_babel_utils36.assertNoAttributeTags)(tag);
10049
+ (0, import_babel_utils35.assertNoAttributeTags)(tag);
10576
10050
  const { node } = tag;
10577
10051
  const [valueAttr] = node.attributes;
10578
10052
  if (!node.var) {
@@ -10644,7 +10118,7 @@ var id_default = {
10644
10118
 
10645
10119
  // src/translator/core/if.ts
10646
10120
  var import_compiler48 = require("@marko/compiler");
10647
- var import_babel_utils37 = require("@marko/compiler/babel-utils");
10121
+ var import_babel_utils36 = require("@marko/compiler/babel-utils");
10648
10122
 
10649
10123
  // src/translator/util/to-first-statement-or-block.ts
10650
10124
  var import_compiler47 = require("@marko/compiler");
@@ -10912,9 +10386,9 @@ var ElseTag = {
10912
10386
  ]
10913
10387
  };
10914
10388
  function assertValidCondition(tag) {
10915
- (0, import_babel_utils37.assertNoVar)(tag);
10916
- (0, import_babel_utils37.assertNoArgs)(tag);
10917
- (0, import_babel_utils37.assertNoParams)(tag);
10389
+ (0, import_babel_utils36.assertNoVar)(tag);
10390
+ (0, import_babel_utils36.assertNoArgs)(tag);
10391
+ (0, import_babel_utils36.assertNoParams)(tag);
10918
10392
  assertHasBody(tag);
10919
10393
  assertNoSpreadAttrs(tag);
10920
10394
  switch (getTagName(tag)) {
@@ -11013,12 +10487,12 @@ function isRoot(tag) {
11013
10487
  }
11014
10488
 
11015
10489
  // src/translator/core/import.ts
11016
- var import_babel_utils38 = require("@marko/compiler/babel-utils");
10490
+ var import_babel_utils37 = require("@marko/compiler/babel-utils");
11017
10491
  var import_default = {
11018
10492
  parse(tag) {
11019
10493
  const { node } = tag;
11020
10494
  tag.replaceWith(
11021
- (0, import_babel_utils38.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
10495
+ (0, import_babel_utils37.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
11022
10496
  );
11023
10497
  },
11024
10498
  parseOptions: {
@@ -11037,7 +10511,7 @@ var import_default = {
11037
10511
 
11038
10512
  // src/translator/core/let.ts
11039
10513
  var import_compiler49 = require("@marko/compiler");
11040
- var import_babel_utils39 = require("@marko/compiler/babel-utils");
10514
+ var import_babel_utils38 = require("@marko/compiler/babel-utils");
11041
10515
  var let_default = {
11042
10516
  analyze(tag) {
11043
10517
  const { node } = tag;
@@ -11066,8 +10540,8 @@ var let_default = {
11066
10540
  }
11067
10541
  }
11068
10542
  }
11069
- (0, import_babel_utils39.assertNoArgs)(tag);
11070
- (0, import_babel_utils39.assertNoParams)(tag);
10543
+ (0, import_babel_utils38.assertNoArgs)(tag);
10544
+ (0, import_babel_utils38.assertNoParams)(tag);
11071
10545
  assertNoBodyContent(tag);
11072
10546
  assertNoSpreadAttrs(tag);
11073
10547
  if (!tagVar) {
@@ -11080,7 +10554,7 @@ var let_default = {
11080
10554
  "The [`<let>` tag](https://markojs.com/docs/reference/core-tag#let) variable cannot be destructured."
11081
10555
  );
11082
10556
  }
11083
- if (valueChangeAttr && (0, import_babel_utils39.computeNode)(valueChangeAttr.value)?.value) {
10557
+ if (valueChangeAttr && (0, import_babel_utils38.computeNode)(valueChangeAttr.value)?.value) {
11084
10558
  throw tag.get("attributes").find((attr) => attr.node === valueChangeAttr).get("value").buildCodeFrameError(
11085
10559
  "The [`<let>` tag](https://markojs.com/docs/reference/core-tag#let) [`valueChange=` attribute](https://markojs.com/docs/reference/core-tag#controllable-let) must be a function."
11086
10560
  );
@@ -11163,13 +10637,13 @@ var let_default = {
11163
10637
 
11164
10638
  // src/translator/core/lifecycle.ts
11165
10639
  var import_compiler50 = require("@marko/compiler");
11166
- var import_babel_utils40 = require("@marko/compiler/babel-utils");
10640
+ var import_babel_utils39 = require("@marko/compiler/babel-utils");
11167
10641
  var kRef = Symbol("lifecycle attrs reference");
11168
10642
  var lifecycle_default = {
11169
10643
  analyze(tag) {
11170
- (0, import_babel_utils40.assertNoArgs)(tag);
11171
- (0, import_babel_utils40.assertNoVar)(tag);
11172
- (0, import_babel_utils40.assertNoParams)(tag);
10644
+ (0, import_babel_utils39.assertNoArgs)(tag);
10645
+ (0, import_babel_utils39.assertNoVar)(tag);
10646
+ (0, import_babel_utils39.assertNoParams)(tag);
11173
10647
  assertNoBodyContent(tag);
11174
10648
  const { node } = tag;
11175
10649
  const section = getOrCreateSection(tag);
@@ -11197,7 +10671,7 @@ var lifecycle_default = {
11197
10671
  }
11198
10672
  (attr.value.extra ??= {}).isEffect = true;
11199
10673
  }
11200
- (0, import_babel_utils40.getProgram)().node.extra.isInteractive = true;
10674
+ (0, import_babel_utils39.getProgram)().node.extra.isInteractive = true;
11201
10675
  },
11202
10676
  translate: {
11203
10677
  exit(tag) {
@@ -11245,13 +10719,13 @@ var lifecycle_default = {
11245
10719
 
11246
10720
  // src/translator/core/log.ts
11247
10721
  var import_compiler51 = require("@marko/compiler");
11248
- var import_babel_utils41 = require("@marko/compiler/babel-utils");
10722
+ var import_babel_utils40 = require("@marko/compiler/babel-utils");
11249
10723
  var log_default = {
11250
10724
  analyze(tag) {
11251
10725
  const [valueAttr] = tag.node.attributes;
11252
- (0, import_babel_utils41.assertNoArgs)(tag);
11253
- (0, import_babel_utils41.assertNoVar)(tag);
11254
- (0, import_babel_utils41.assertNoParams)(tag);
10726
+ (0, import_babel_utils40.assertNoArgs)(tag);
10727
+ (0, import_babel_utils40.assertNoVar)(tag);
10728
+ (0, import_babel_utils40.assertNoParams)(tag);
11255
10729
  assertNoBodyContent(tag);
11256
10730
  if (!valueAttr) {
11257
10731
  throw tag.get("name").buildCodeFrameError(
@@ -11299,7 +10773,7 @@ var log_default = {
11299
10773
 
11300
10774
  // src/translator/core/script.ts
11301
10775
  var import_compiler52 = require("@marko/compiler");
11302
- var import_babel_utils42 = require("@marko/compiler/babel-utils");
10776
+ var import_babel_utils41 = require("@marko/compiler/babel-utils");
11303
10777
  var htmlScriptTagAlternateMsg = " For a native html [`<script>` tag](https://markojs.com/docs/reference/core-tag#script) use the `html-script` core tag instead.";
11304
10778
  var script_default = {
11305
10779
  parse(tag) {
@@ -11319,7 +10793,7 @@ var script_default = {
11319
10793
  }
11320
10794
  const start = body[0]?.start;
11321
10795
  const end = body[body.length - 1]?.end;
11322
- const bodyStatements = (0, import_babel_utils42.parseStatements)(tag.hub.file, code, start, end);
10796
+ const bodyStatements = (0, import_babel_utils41.parseStatements)(tag.hub.file, code, start, end);
11323
10797
  if (bodyStatements.length) {
11324
10798
  const valueFn = import_compiler52.types.arrowFunctionExpression(
11325
10799
  [],
@@ -11333,10 +10807,10 @@ var script_default = {
11333
10807
  },
11334
10808
  analyze(tag) {
11335
10809
  const { node } = tag;
11336
- (0, import_babel_utils42.assertNoArgs)(tag);
11337
- (0, import_babel_utils42.assertNoParams)(tag);
10810
+ (0, import_babel_utils41.assertNoArgs)(tag);
10811
+ (0, import_babel_utils41.assertNoParams)(tag);
11338
10812
  assertNoBodyContent(tag);
11339
- (0, import_babel_utils42.assertNoAttributeTags)(tag);
10813
+ (0, import_babel_utils41.assertNoAttributeTags)(tag);
11340
10814
  if (node.var) {
11341
10815
  throw tag.hub.buildError(
11342
10816
  node.var,
@@ -11351,7 +10825,7 @@ var script_default = {
11351
10825
  }
11352
10826
  seenValueAttr = true;
11353
10827
  (attr.value.extra ??= {}).isEffect = true;
11354
- (0, import_babel_utils42.getProgram)().node.extra.isInteractive = true;
10828
+ (0, import_babel_utils41.getProgram)().node.extra.isInteractive = true;
11355
10829
  } else {
11356
10830
  throw tag.hub.buildError(
11357
10831
  attr,
@@ -11413,7 +10887,6 @@ var script_default = {
11413
10887
  text: true,
11414
10888
  preserveWhitespace: true
11415
10889
  },
11416
- attributes: {},
11417
10890
  autocomplete: [
11418
10891
  {
11419
10892
  description: "Use to create a side effects.",
@@ -11442,7 +10915,7 @@ function isAwaitExpression(node) {
11442
10915
 
11443
10916
  // src/translator/core/server.ts
11444
10917
  var import_compiler53 = require("@marko/compiler");
11445
- var import_babel_utils43 = require("@marko/compiler/babel-utils");
10918
+ var import_babel_utils42 = require("@marko/compiler/babel-utils");
11446
10919
  var server_default = {
11447
10920
  parse(tag) {
11448
10921
  const {
@@ -11452,7 +10925,7 @@ var server_default = {
11452
10925
  const rawValue = node.rawValue;
11453
10926
  const code = rawValue.replace(/^server\s*/, "");
11454
10927
  const start = node.start + (rawValue.length - code.length);
11455
- let body = (0, import_babel_utils43.parseStatements)(file, code, start, start + code.length);
10928
+ let body = (0, import_babel_utils42.parseStatements)(file, code, start, start + code.length);
11456
10929
  if (body.length === 1 && import_compiler53.types.isBlockStatement(body[0])) {
11457
10930
  body = body[0].body;
11458
10931
  }
@@ -11473,7 +10946,7 @@ var server_default = {
11473
10946
 
11474
10947
  // src/translator/core/static.ts
11475
10948
  var import_compiler54 = require("@marko/compiler");
11476
- var import_babel_utils44 = require("@marko/compiler/babel-utils");
10949
+ var import_babel_utils43 = require("@marko/compiler/babel-utils");
11477
10950
  var static_default = {
11478
10951
  parse(tag) {
11479
10952
  const {
@@ -11483,7 +10956,7 @@ var static_default = {
11483
10956
  const rawValue = node.rawValue;
11484
10957
  const code = rawValue.replace(/^static\s*/, "");
11485
10958
  const start = node.start + (rawValue.length - code.length);
11486
- let body = (0, import_babel_utils44.parseStatements)(file, code, start, start + code.length);
10959
+ let body = (0, import_babel_utils43.parseStatements)(file, code, start, start + code.length);
11487
10960
  if (body.length === 1 && import_compiler54.types.isBlockStatement(body[0])) {
11488
10961
  body = body[0].body;
11489
10962
  }
@@ -11504,16 +10977,16 @@ var static_default = {
11504
10977
 
11505
10978
  // src/translator/core/style.ts
11506
10979
  var import_compiler55 = require("@marko/compiler");
11507
- var import_babel_utils45 = require("@marko/compiler/babel-utils");
10980
+ var import_babel_utils44 = require("@marko/compiler/babel-utils");
11508
10981
  var import_magic_string = __toESM(require("magic-string"));
11509
10982
  var import_path3 = __toESM(require("path"));
11510
10983
  var STYLE_EXT_REG = /^style((?:\.[a-zA-Z0-9$_-]+)+)?/;
11511
10984
  var htmlStyleTagAlternateMsg = " For a native html [`<style>` tag](https://markojs.com/docs/reference/core-tag#style) use the `html-style` core tag instead.";
11512
10985
  var style_default = {
11513
10986
  analyze(tag) {
11514
- (0, import_babel_utils45.assertNoArgs)(tag);
11515
- (0, import_babel_utils45.assertNoParams)(tag);
11516
- (0, import_babel_utils45.assertNoAttributeTags)(tag);
10987
+ (0, import_babel_utils44.assertNoArgs)(tag);
10988
+ (0, import_babel_utils44.assertNoParams)(tag);
10989
+ (0, import_babel_utils44.assertNoAttributeTags)(tag);
11517
10990
  const { node } = tag;
11518
10991
  const ext = STYLE_EXT_REG.exec(node.rawValue || "")?.[1]?.slice(1);
11519
10992
  for (const attr of node.attributes) {
@@ -11552,8 +11025,8 @@ var style_default = {
11552
11025
  }
11553
11026
  const markoText = node.body.body[0];
11554
11027
  const { resolveVirtualDependency } = getMarkoOpts();
11555
- const start = (0, import_babel_utils45.getStart)(file, markoText);
11556
- const end = (0, import_babel_utils45.getEnd)(file, markoText);
11028
+ const start = (0, import_babel_utils44.getStart)(file, markoText);
11029
+ const end = (0, import_babel_utils44.getEnd)(file, markoText);
11557
11030
  let code = markoText.value;
11558
11031
  let map;
11559
11032
  if (resolveVirtualDependency && sourceMaps && start !== null && end !== null) {
@@ -11563,422 +11036,63 @@ var style_default = {
11563
11036
  map = magicString.generateMap({
11564
11037
  source: filename,
11565
11038
  includeContent: true
11566
- });
11567
- if (sourceMaps === "inline" || sourceMaps === "both") {
11568
- code += `
11569
- /*# sourceMappingURL=${map.toUrl()}*/`;
11570
- if (sourceMaps === "inline") {
11571
- map = void 0;
11572
- }
11573
- }
11574
- }
11575
- const importPath = resolveVirtualDependency?.(filename, {
11576
- virtualPath: `./${import_path3.default.basename(filename) + ext}`,
11577
- code,
11578
- map
11579
- });
11580
- if (importPath) {
11581
- if (!node.var) {
11582
- (0, import_babel_utils45.getProgram)().node.body.push(
11583
- import_compiler55.types.importDeclaration([], import_compiler55.types.stringLiteral(importPath))
11584
- );
11585
- } else if (import_compiler55.types.isIdentifier(node.var)) {
11586
- (0, import_babel_utils45.getProgram)().node.body.push(
11587
- import_compiler55.types.importDeclaration(
11588
- [import_compiler55.types.importNamespaceSpecifier(node.var)],
11589
- import_compiler55.types.stringLiteral(importPath)
11590
- )
11591
- );
11592
- } else {
11593
- const varDecl = import_compiler55.types.variableDeclaration("const", [
11594
- import_compiler55.types.variableDeclarator(node.var, (0, import_babel_utils45.importStar)(file, importPath, "style"))
11595
- ]);
11596
- (0, import_babel_utils45.getProgram)().node.body.push(
11597
- isOutputDOM() ? varDecl : import_compiler55.types.markoScriptlet([varDecl], true)
11598
- );
11599
- }
11600
- }
11601
- tag.remove();
11602
- },
11603
- parseOptions: {
11604
- html: false,
11605
- text: true,
11606
- rawOpenTag: true,
11607
- preserveWhitespace: true
11608
- },
11609
- attributes: {}
11610
- };
11611
-
11612
- // src/translator/core/textarea.ts
11613
- var import_compiler56 = require("@marko/compiler");
11614
- var textarea_default = {
11615
- parse(tag) {
11616
- if (tag.node.body.body.length) {
11617
- const parts = [];
11618
- for (const child of tag.node.body.body) {
11619
- if (child.type === "MarkoText" || child.type === "MarkoPlaceholder" && child.escape) {
11620
- parts.push(child.value);
11621
- } else {
11622
- throw tag.hub.file.hub.buildError(
11623
- child,
11624
- "Unexpected content in textarea, only text and placeholders are supported.",
11625
- SyntaxError
11626
- );
11627
- }
11628
- }
11629
- tag.node.attributes.push(
11630
- import_compiler56.types.markoAttribute(
11631
- "value",
11632
- normalizeStringExpression(parts) || buildUndefined3()
11633
- )
11634
- );
11635
- tag.node.body.body = [];
11636
- }
11637
- },
11638
- parseOptions: {
11639
- text: true,
11640
- preserveWhitespace: true
11641
- }
11642
- };
11643
- function buildUndefined3() {
11644
- return import_compiler56.types.unaryExpression("void", import_compiler56.types.numericLiteral(0));
11645
- }
11646
-
11647
- // src/translator/core/title.ts
11648
- var import_compiler57 = require("@marko/compiler");
11649
- var import_babel_utils46 = require("@marko/compiler/babel-utils");
11650
- var kNodeBinding4 = Symbol("title tag node binding");
11651
- var title_default = {
11652
- analyze(tag) {
11653
- (0, import_babel_utils46.assertNoArgs)(tag);
11654
- (0, import_babel_utils46.assertNoParams)(tag);
11655
- const { node } = tag;
11656
- if (node.var && !import_compiler57.types.isIdentifier(node.var)) {
11657
- throw tag.get("var").buildCodeFrameError(
11658
- "Tag variables on native elements cannot be destructured."
11659
- );
11660
- }
11661
- const seen = {};
11662
- const { attributes } = tag.node;
11663
- let spreadReferenceNodes;
11664
- let exprExtras;
11665
- let hasEventHandlers = false;
11666
- let hasDynamicAttributes = false;
11667
- for (let i = attributes.length; i--; ) {
11668
- const attr = attributes[i];
11669
- const valueExtra = attr.value.extra ??= {};
11670
- if (import_compiler57.types.isMarkoAttribute(attr)) {
11671
- if (seen[attr.name]) {
11672
- dropReferences(attr.value);
11673
- continue;
11674
- }
11675
- seen[attr.name] = attr;
11676
- if (isEventHandler(attr.name)) {
11677
- valueExtra.isEffect = true;
11678
- hasEventHandlers = true;
11679
- } else if (!evaluate(attr.value).confident) {
11680
- hasDynamicAttributes = true;
11039
+ });
11040
+ if (sourceMaps === "inline" || sourceMaps === "both") {
11041
+ code += `
11042
+ /*# sourceMappingURL=${map.toUrl()}*/`;
11043
+ if (sourceMaps === "inline") {
11044
+ map = void 0;
11681
11045
  }
11682
- } else if (import_compiler57.types.isMarkoSpreadAttribute(attr)) {
11683
- valueExtra.isEffect = true;
11684
- hasEventHandlers = true;
11685
- hasDynamicAttributes = true;
11686
- }
11687
- if (spreadReferenceNodes) {
11688
- spreadReferenceNodes.push(attr.value);
11689
- } else if (import_compiler57.types.isMarkoSpreadAttribute(attr)) {
11690
- spreadReferenceNodes = [attr.value];
11691
- } else {
11692
- exprExtras = push(exprExtras, valueExtra);
11693
11046
  }
11694
11047
  }
11695
- const bodyPlaceholderNodes = [];
11696
- let hasBodyPlaceholders = false;
11697
- for (const child of tag.node.body.body) {
11698
- if (import_compiler57.types.isMarkoPlaceholder(child)) {
11699
- bodyPlaceholderNodes.push(child.value);
11700
- hasBodyPlaceholders = true;
11701
- } else if (!import_compiler57.types.isMarkoText(child)) {
11702
- throw tag.hub.buildError(
11703
- child,
11704
- "Invalid child. Only text is allowed inside a `<title>`."
11048
+ const importPath = resolveVirtualDependency?.(filename, {
11049
+ virtualPath: `./${import_path3.default.basename(filename) + ext}`,
11050
+ code,
11051
+ map
11052
+ });
11053
+ if (importPath) {
11054
+ if (!node.var) {
11055
+ (0, import_babel_utils44.getProgram)().node.body.push(
11056
+ import_compiler55.types.importDeclaration([], import_compiler55.types.stringLiteral(importPath))
11705
11057
  );
11706
- }
11707
- }
11708
- if (node.var || hasEventHandlers || hasDynamicAttributes || hasBodyPlaceholders) {
11709
- const tagExtra = node.extra ??= {};
11710
- const tagSection = getOrCreateSection(tag);
11711
- const nodeBinding = tagExtra[kNodeBinding4] = createBinding(
11712
- "#title",
11713
- 0 /* dom */,
11714
- tagSection
11715
- );
11716
- if (hasEventHandlers) {
11717
- (0, import_babel_utils46.getProgram)().node.extra.isInteractive = true;
11718
- }
11719
- if (spreadReferenceNodes) {
11720
- mergeReferences(tagSection, tag.node, spreadReferenceNodes);
11721
- }
11722
- if (hasBodyPlaceholders) {
11723
- exprExtras = push(
11724
- exprExtras,
11725
- bodyPlaceholderNodes.length === 1 ? bodyPlaceholderNodes[0].extra ??= {} : mergeReferences(
11726
- tagSection,
11727
- bodyPlaceholderNodes[0],
11728
- bodyPlaceholderNodes.slice(1)
11058
+ } else if (import_compiler55.types.isIdentifier(node.var)) {
11059
+ (0, import_babel_utils44.getProgram)().node.body.push(
11060
+ import_compiler55.types.importDeclaration(
11061
+ [import_compiler55.types.importNamespaceSpecifier(node.var)],
11062
+ import_compiler55.types.stringLiteral(importPath)
11729
11063
  )
11730
11064
  );
11731
- }
11732
- trackDomVarReferences(tag, nodeBinding);
11733
- addSerializeExpr(
11734
- tagSection,
11735
- !!(node.var || hasEventHandlers),
11736
- nodeBinding
11737
- );
11738
- addSerializeExpr(tagSection, push(exprExtras, tagExtra), nodeBinding);
11739
- }
11740
- },
11741
- translate: {
11742
- enter(tag) {
11743
- const tagExtra = tag.node.extra;
11744
- const nodeBinding = tagExtra[kNodeBinding4];
11745
- const isHTML = isOutputHTML();
11746
- const write = writeTo(tag);
11747
- const tagSection = getSection(tag);
11748
- if (isHTML) {
11749
- translateDomVar(tag, nodeBinding);
11750
- }
11751
- if (nodeBinding) {
11752
- visit(tag, 32 /* Get */);
11753
- }
11754
- write`<title`;
11755
- const usedAttrs = getUsedAttrs4(tag.node);
11756
- const { staticAttrs, skipExpression, spreadExpression } = usedAttrs;
11757
- for (const attr of staticAttrs) {
11758
- const { name: name2, value } = attr;
11759
- const { confident, computed } = value.extra || {};
11760
- const valueReferences = value.extra?.referencedBindings;
11761
- switch (name2) {
11762
- case "class":
11763
- case "style": {
11764
- const helper = `_attr_${name2}`;
11765
- if (confident) {
11766
- write`${getHTMLRuntime()[helper](computed)}`;
11767
- } else if (isHTML) {
11768
- write`${callRuntime(helper, value)}`;
11769
- } else {
11770
- addStatement(
11771
- "render",
11772
- tagSection,
11773
- valueReferences,
11774
- import_compiler57.types.expressionStatement(
11775
- callRuntime(
11776
- helper,
11777
- createScopeReadExpression(nodeBinding),
11778
- value
11779
- )
11780
- )
11781
- );
11782
- }
11783
- break;
11784
- }
11785
- default:
11786
- if (confident) {
11787
- write`${getHTMLRuntime()._attr(name2, computed)}`;
11788
- } else if (isHTML) {
11789
- if (isEventHandler(name2)) {
11790
- addHTMLEffectCall(tagSection, valueReferences);
11791
- } else {
11792
- write`${callRuntime("_attr", import_compiler57.types.stringLiteral(name2), value)}`;
11793
- }
11794
- } else if (isEventHandler(name2)) {
11795
- addStatement(
11796
- "effect",
11797
- tagSection,
11798
- valueReferences,
11799
- import_compiler57.types.expressionStatement(
11800
- callRuntime(
11801
- "_on",
11802
- createScopeReadExpression(nodeBinding),
11803
- import_compiler57.types.stringLiteral(getEventHandlerName(name2)),
11804
- value
11805
- )
11806
- )
11807
- );
11808
- } else {
11809
- addStatement(
11810
- "render",
11811
- tagSection,
11812
- valueReferences,
11813
- import_compiler57.types.expressionStatement(
11814
- callRuntime(
11815
- "_attr",
11816
- createScopeReadExpression(nodeBinding),
11817
- import_compiler57.types.stringLiteral(name2),
11818
- value
11819
- )
11820
- )
11821
- );
11822
- }
11823
- break;
11824
- }
11825
- }
11826
- if (spreadExpression) {
11827
- const visitAccessor = getScopeAccessorLiteral(nodeBinding);
11828
- if (isHTML) {
11829
- addHTMLEffectCall(tagSection, tagExtra.referencedBindings);
11830
- if (skipExpression) {
11831
- write`${callRuntime("_attrs_partial", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler57.types.stringLiteral("title"))}`;
11832
- } else {
11833
- write`${callRuntime("_attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(tagSection), import_compiler57.types.stringLiteral("title"))}`;
11834
- }
11835
- } else {
11836
- if (skipExpression) {
11837
- addStatement(
11838
- "render",
11839
- tagSection,
11840
- tagExtra.referencedBindings,
11841
- import_compiler57.types.expressionStatement(
11842
- callRuntime(
11843
- "_attrs_partial",
11844
- scopeIdentifier,
11845
- visitAccessor,
11846
- spreadExpression,
11847
- skipExpression
11848
- )
11849
- )
11850
- );
11851
- } else {
11852
- addStatement(
11853
- "render",
11854
- tagSection,
11855
- tagExtra.referencedBindings,
11856
- import_compiler57.types.expressionStatement(
11857
- callRuntime(
11858
- "_attrs",
11859
- scopeIdentifier,
11860
- visitAccessor,
11861
- spreadExpression
11862
- )
11863
- )
11864
- );
11865
- }
11866
- addStatement(
11867
- "effect",
11868
- tagSection,
11869
- tagExtra.referencedBindings,
11870
- import_compiler57.types.expressionStatement(
11871
- callRuntime("_attrs_script", scopeIdentifier, visitAccessor)
11872
- ),
11873
- false
11874
- );
11875
- }
11876
- }
11877
- write`>`;
11878
- enter2(tag);
11879
- },
11880
- exit(tag) {
11881
- const tagSection = getSection(tag);
11882
- const tagExtra = tag.node.extra;
11883
- const nodeBinding = tagExtra[kNodeBinding4];
11884
- const write = writeTo(tag);
11885
- if (isOutputHTML()) {
11886
- for (const child of tag.node.body.body) {
11887
- if (import_compiler57.types.isMarkoText(child)) {
11888
- write`${child.value}`;
11889
- } else if (import_compiler57.types.isMarkoPlaceholder(child)) {
11890
- write`${callRuntime("_to_text", child.value)}`;
11891
- }
11892
- }
11893
11065
  } else {
11894
- const textLiteral = bodyToTextLiteral(tag.node.body);
11895
- if (import_compiler57.types.isStringLiteral(textLiteral)) {
11896
- write`${textLiteral}`;
11897
- } else {
11898
- addStatement(
11899
- "render",
11900
- getSection(tag),
11901
- textLiteral.extra?.referencedBindings,
11902
- import_compiler57.types.expressionStatement(
11903
- callRuntime(
11904
- "_text_content",
11905
- createScopeReadExpression(nodeBinding),
11906
- textLiteral
11907
- )
11908
- )
11909
- );
11910
- }
11911
- }
11912
- write`</title>`;
11913
- if (nodeBinding) {
11914
- markNode(
11915
- tag,
11916
- nodeBinding,
11917
- getSerializeReason(tagSection, nodeBinding)
11066
+ const varDecl = import_compiler55.types.variableDeclaration("const", [
11067
+ import_compiler55.types.variableDeclarator(node.var, (0, import_babel_utils44.importStar)(file, importPath, "style"))
11068
+ ]);
11069
+ (0, import_babel_utils44.getProgram)().node.body.push(
11070
+ isOutputDOM() ? varDecl : import_compiler55.types.markoScriptlet([varDecl], true)
11918
11071
  );
11919
11072
  }
11920
- exit2(tag);
11921
- tag.remove();
11922
11073
  }
11074
+ tag.remove();
11923
11075
  },
11924
11076
  parseOptions: {
11925
- text: true
11926
- }
11077
+ html: false,
11078
+ text: true,
11079
+ rawOpenTag: true,
11080
+ preserveWhitespace: true
11081
+ },
11082
+ attributes: {}
11927
11083
  };
11928
- function getUsedAttrs4(tag) {
11929
- const seen = {};
11930
- const { attributes } = tag;
11931
- const maybeStaticAttrs = /* @__PURE__ */ new Set();
11932
- let spreadExpression;
11933
- let skipExpression;
11934
- let spreadProps;
11935
- let skipProps;
11936
- for (let i = attributes.length; i--; ) {
11937
- const attr = attributes[i];
11938
- const { value } = attr;
11939
- if (import_compiler57.types.isMarkoSpreadAttribute(attr)) {
11940
- if (!spreadProps) {
11941
- spreadProps = [];
11942
- }
11943
- spreadProps.push(import_compiler57.types.spreadElement(value));
11944
- } else if (!seen[attr.name]) {
11945
- seen[attr.name] = attr;
11946
- if (spreadProps) {
11947
- spreadProps.push(toObjectProperty(attr.name, attr.value));
11948
- } else {
11949
- maybeStaticAttrs.add(attr);
11950
- }
11951
- }
11952
- }
11953
- const staticAttrs = [...maybeStaticAttrs].reverse();
11954
- if (spreadProps) {
11955
- spreadProps.reverse();
11956
- for (const { name: name2 } of staticAttrs) {
11957
- (skipProps ||= []).push(toObjectProperty(name2, import_compiler57.types.numericLiteral(1)));
11958
- }
11959
- if (skipProps) {
11960
- skipExpression = import_compiler57.types.objectExpression(skipProps);
11961
- }
11962
- spreadExpression = propsToExpression(spreadProps);
11963
- }
11964
- return {
11965
- staticAttrs,
11966
- spreadExpression,
11967
- skipExpression
11968
- };
11969
- }
11970
11084
 
11971
11085
  // src/translator/core/try.ts
11972
- var import_compiler58 = require("@marko/compiler");
11973
- var import_babel_utils47 = require("@marko/compiler/babel-utils");
11086
+ var import_compiler56 = require("@marko/compiler");
11087
+ var import_babel_utils45 = require("@marko/compiler/babel-utils");
11974
11088
  var hasEnabledCatch = /* @__PURE__ */ new WeakSet();
11975
11089
  var kDOMBinding2 = Symbol("try tag dom binding");
11976
11090
  var try_default = {
11977
11091
  analyze(tag) {
11978
- (0, import_babel_utils47.assertNoVar)(tag);
11979
- (0, import_babel_utils47.assertNoArgs)(tag);
11980
- (0, import_babel_utils47.assertNoParams)(tag);
11981
- (0, import_babel_utils47.assertNoAttributes)(tag);
11092
+ (0, import_babel_utils45.assertNoVar)(tag);
11093
+ (0, import_babel_utils45.assertNoArgs)(tag);
11094
+ (0, import_babel_utils45.assertNoParams)(tag);
11095
+ (0, import_babel_utils45.assertNoAttributes)(tag);
11982
11096
  assertNoSpreadAttrs(tag);
11983
11097
  analyzeAttributeTags(tag);
11984
11098
  const section = getOrCreateSection(tag);
@@ -12030,7 +11144,7 @@ var try_default = {
12030
11144
  writeHTMLResumeStatements(tagBody);
12031
11145
  tag.insertBefore(translatedAttrs.statements);
12032
11146
  tag.replaceWith(
12033
- import_compiler58.types.expressionStatement(
11147
+ import_compiler56.types.expressionStatement(
12034
11148
  callRuntime(
12035
11149
  "_try",
12036
11150
  getScopeIdIdentifier(section),
@@ -12085,11 +11199,11 @@ var try_default = {
12085
11199
  translatedAttrs.statements
12086
11200
  );
12087
11201
  }
12088
- const program = (0, import_babel_utils47.getProgram)().node;
11202
+ const program = (0, import_babel_utils45.getProgram)().node;
12089
11203
  if (!hasEnabledCatch.has(program)) {
12090
11204
  hasEnabledCatch.add(program);
12091
11205
  program.body.push(
12092
- import_compiler58.types.expressionStatement(callRuntime("_enable_catch"))
11206
+ import_compiler56.types.expressionStatement(callRuntime("_enable_catch"))
12093
11207
  );
12094
11208
  }
12095
11209
  addValue(
@@ -12140,8 +11254,6 @@ var core_default = {
12140
11254
  "<server>": server_default,
12141
11255
  "<static>": static_default,
12142
11256
  "<style>": style_default,
12143
- "<textarea>": textarea_default,
12144
- "<title>": title_default,
12145
11257
  "<try>": try_default
12146
11258
  };
12147
11259
 
@@ -12189,13 +11301,13 @@ var document_type_default = {
12189
11301
  };
12190
11302
 
12191
11303
  // src/translator/visitors/import-declaration.ts
12192
- var import_babel_utils48 = require("@marko/compiler/babel-utils");
11304
+ var import_babel_utils46 = require("@marko/compiler/babel-utils");
12193
11305
  var import_declaration_default = {
12194
11306
  analyze(importDecl) {
12195
11307
  const { node } = importDecl;
12196
11308
  const { source } = node;
12197
11309
  const { value } = source;
12198
- const tagImport = (0, import_babel_utils48.resolveTagImport)(importDecl, value);
11310
+ const tagImport = (0, import_babel_utils46.resolveTagImport)(importDecl, value);
12199
11311
  if (tagImport) {
12200
11312
  node.extra ??= {};
12201
11313
  node.extra.tagImport = tagImport;
@@ -12218,26 +11330,8 @@ var import_declaration_default = {
12218
11330
  };
12219
11331
 
12220
11332
  // src/translator/visitors/placeholder.ts
12221
- var import_compiler60 = require("@marko/compiler");
12222
-
12223
- // src/translator/util/is-non-html-text.ts
12224
- var import_compiler59 = require("@marko/compiler");
12225
- function isNonHTMLText(placeholder) {
12226
- const parentTag = placeholder.parentPath.isMarkoTagBody() && placeholder.parentPath.parentPath;
12227
- if (parentTag && isCoreTag(parentTag)) {
12228
- switch (parentTag.node.name.value) {
12229
- case "html-comment":
12230
- case "html-script":
12231
- case "html-style":
12232
- case "title":
12233
- return true;
12234
- }
12235
- }
12236
- return false;
12237
- }
12238
-
12239
- // src/translator/visitors/placeholder.ts
12240
- var kNodeBinding5 = Symbol("placeholder node binding");
11333
+ var import_compiler57 = require("@marko/compiler");
11334
+ var kNodeBinding2 = Symbol("placeholder node binding");
12241
11335
  var kSiblingText = Symbol("placeholder has sibling text");
12242
11336
  var kSharedText = Symbol(
12243
11337
  "placeholder will merge its visitor with a another node"
@@ -12255,7 +11349,7 @@ var placeholder_default = {
12255
11349
  }
12256
11350
  } else {
12257
11351
  const section = getOrCreateSection(placeholder);
12258
- const nodeBinding = (node.extra ??= {})[kNodeBinding5] = createBinding(
11352
+ const nodeBinding = (node.extra ??= {})[kNodeBinding2] = createBinding(
12259
11353
  "#text",
12260
11354
  0 /* dom */,
12261
11355
  section
@@ -12278,7 +11372,7 @@ var placeholder_default = {
12278
11372
  const isHTML = isOutputHTML();
12279
11373
  const write = writeTo(placeholder);
12280
11374
  const extra = node.extra || {};
12281
- const nodeBinding = extra[kNodeBinding5];
11375
+ const nodeBinding = extra[kNodeBinding2];
12282
11376
  const canWriteHTML = isHTML || confident && node.escape;
12283
11377
  const method = canWriteHTML ? node.escape ? "_escape" : "_unescaped" : node.escape ? "_text" : "_html";
12284
11378
  if (confident && canWriteHTML) {
@@ -12312,7 +11406,7 @@ var placeholder_default = {
12312
11406
  "render",
12313
11407
  getSection(placeholder),
12314
11408
  valueExtra.referencedBindings,
12315
- import_compiler60.types.expressionStatement(
11409
+ import_compiler57.types.expressionStatement(
12316
11410
  method === "_text" ? callRuntime(
12317
11411
  "_text",
12318
11412
  createScopeReadExpression(nodeBinding),
@@ -12350,7 +11444,7 @@ function analyzeSiblingText(placeholder) {
12350
11444
  break;
12351
11445
  }
12352
11446
  }
12353
- if (!prev.node && import_compiler60.types.isProgram(placeholder.parentPath)) {
11447
+ if (!prev.node && import_compiler57.types.isProgram(placeholder.parentPath)) {
12354
11448
  return placeholderExtra[kSiblingText] = 1 /* Before */;
12355
11449
  }
12356
11450
  let next = placeholder.getNextSibling();
@@ -12367,7 +11461,7 @@ function analyzeSiblingText(placeholder) {
12367
11461
  break;
12368
11462
  }
12369
11463
  }
12370
- if (!next.node && import_compiler60.types.isProgram(placeholder.parentPath)) {
11464
+ if (!next.node && import_compiler57.types.isProgram(placeholder.parentPath)) {
12371
11465
  return placeholderExtra[kSiblingText] = 2 /* After */;
12372
11466
  }
12373
11467
  return placeholderExtra[kSiblingText] = 0 /* None */;
@@ -12409,7 +11503,7 @@ function isEmptyPlaceholder(placeholder) {
12409
11503
  }
12410
11504
 
12411
11505
  // src/translator/visitors/referenced-identifier.ts
12412
- var import_compiler61 = require("@marko/compiler");
11506
+ var import_compiler58 = require("@marko/compiler");
12413
11507
  var abortIdsByExpressionForSection = /* @__PURE__ */ new WeakMap();
12414
11508
  var referenced_identifier_default = {
12415
11509
  migrate(identifier) {
@@ -12417,8 +11511,8 @@ var referenced_identifier_default = {
12417
11511
  if (identifier.scope.hasBinding(name2)) return;
12418
11512
  switch (name2) {
12419
11513
  case "out":
12420
- if (import_compiler61.types.isMemberExpression(identifier.parent) && import_compiler61.types.isIdentifier(identifier.parent.property) && identifier.parent.property.name === "global") {
12421
- identifier.parentPath.replaceWith(import_compiler61.types.identifier("$global"));
11514
+ if (import_compiler58.types.isMemberExpression(identifier.parent) && import_compiler58.types.isIdentifier(identifier.parent.property) && identifier.parent.property.name === "global") {
11515
+ identifier.parentPath.replaceWith(import_compiler58.types.identifier("$global"));
12422
11516
  } else {
12423
11517
  throw identifier.buildCodeFrameError(
12424
11518
  "Only `out.global` is supported for compatibility."
@@ -12445,13 +11539,13 @@ var referenced_identifier_default = {
12445
11539
  case "$global":
12446
11540
  if (isOutputHTML()) {
12447
11541
  identifier.replaceWith(
12448
- import_compiler61.types.callExpression(importRuntime("$global"), [])
11542
+ import_compiler58.types.callExpression(importRuntime("$global"), [])
12449
11543
  );
12450
11544
  } else {
12451
11545
  identifier.replaceWith(
12452
- import_compiler61.types.memberExpression(
11546
+ import_compiler58.types.memberExpression(
12453
11547
  scopeIdentifier,
12454
- import_compiler61.types.identifier(getAccessorProp().Global)
11548
+ import_compiler58.types.identifier(getAccessorProp().Global)
12455
11549
  )
12456
11550
  );
12457
11551
  }
@@ -12459,13 +11553,13 @@ var referenced_identifier_default = {
12459
11553
  case "$signal":
12460
11554
  if (isOutputHTML()) {
12461
11555
  identifier.replaceWith(
12462
- import_compiler61.types.callExpression(
12463
- import_compiler61.types.arrowFunctionExpression(
11556
+ import_compiler58.types.callExpression(
11557
+ import_compiler58.types.arrowFunctionExpression(
12464
11558
  [],
12465
- import_compiler61.types.blockStatement([
12466
- import_compiler61.types.throwStatement(
12467
- import_compiler61.types.newExpression(import_compiler61.types.identifier("Error"), [
12468
- import_compiler61.types.stringLiteral("Cannot use $signal in a server render.")
11559
+ import_compiler58.types.blockStatement([
11560
+ import_compiler58.types.throwStatement(
11561
+ import_compiler58.types.newExpression(import_compiler58.types.identifier("Error"), [
11562
+ import_compiler58.types.stringLiteral("Cannot use $signal in a server render.")
12469
11563
  ])
12470
11564
  )
12471
11565
  ])
@@ -12491,19 +11585,19 @@ var referenced_identifier_default = {
12491
11585
  "render",
12492
11586
  section,
12493
11587
  exprRoot.node.extra?.referencedBindings,
12494
- import_compiler61.types.expressionStatement(
12495
- import_compiler61.types.callExpression(importRuntime("$signalReset"), [
11588
+ import_compiler58.types.expressionStatement(
11589
+ import_compiler58.types.callExpression(importRuntime("$signalReset"), [
12496
11590
  scopeIdentifier,
12497
- import_compiler61.types.numericLiteral(exprId)
11591
+ import_compiler58.types.numericLiteral(exprId)
12498
11592
  ])
12499
11593
  ),
12500
11594
  false
12501
11595
  );
12502
11596
  }
12503
11597
  identifier.replaceWith(
12504
- import_compiler61.types.callExpression(importRuntime("$signal"), [
11598
+ import_compiler58.types.callExpression(importRuntime("$signal"), [
12505
11599
  scopeIdentifier,
12506
- import_compiler61.types.numericLiteral(exprId)
11600
+ import_compiler58.types.numericLiteral(exprId)
12507
11601
  ])
12508
11602
  );
12509
11603
  }
@@ -12512,7 +11606,7 @@ var referenced_identifier_default = {
12512
11606
  };
12513
11607
 
12514
11608
  // src/translator/visitors/scriptlet.ts
12515
- var import_babel_utils49 = require("@marko/compiler/babel-utils");
11609
+ var import_babel_utils47 = require("@marko/compiler/babel-utils");
12516
11610
  var scriptlet_default = {
12517
11611
  analyze(scriptlet) {
12518
11612
  if (!scriptlet.node.static) {
@@ -12526,7 +11620,7 @@ var scriptlet_default = {
12526
11620
  scriptlet.node.body
12527
11621
  );
12528
11622
  if (scriptlet.node.target === "client") {
12529
- (0, import_babel_utils49.getProgram)().node.extra.isInteractive = true;
11623
+ (0, import_babel_utils47.getProgram)().node.extra.isInteractive = true;
12530
11624
  }
12531
11625
  },
12532
11626
  translate: {
@@ -12547,21 +11641,21 @@ var scriptlet_default = {
12547
11641
  };
12548
11642
 
12549
11643
  // src/translator/visitors/tag/index.ts
12550
- var import_compiler65 = require("@marko/compiler");
12551
- var import_babel_utils53 = require("@marko/compiler/babel-utils");
11644
+ var import_compiler62 = require("@marko/compiler");
11645
+ var import_babel_utils51 = require("@marko/compiler/babel-utils");
12552
11646
 
12553
11647
  // src/translator/visitors/tag/attribute-tag.ts
12554
- var import_compiler62 = require("@marko/compiler");
12555
- var import_babel_utils50 = require("@marko/compiler/babel-utils");
11648
+ var import_compiler59 = require("@marko/compiler");
11649
+ var import_babel_utils48 = require("@marko/compiler/babel-utils");
12556
11650
  var attribute_tag_default = {
12557
11651
  analyze: {
12558
11652
  enter(tag) {
12559
- (0, import_babel_utils50.assertNoVar)(tag);
12560
- (0, import_babel_utils50.assertNoArgs)(tag);
11653
+ (0, import_babel_utils48.assertNoVar)(tag);
11654
+ (0, import_babel_utils48.assertNoArgs)(tag);
12561
11655
  const body = tag.get("body");
12562
11656
  startSection(body);
12563
11657
  trackParamsReferences(body, 3 /* param */);
12564
- if (!(0, import_babel_utils50.findParentTag)(tag)) {
11658
+ if (!(0, import_babel_utils48.findParentTag)(tag)) {
12565
11659
  throw tag.get("name").buildCodeFrameError(
12566
11660
  "[Attribute tags](https://markojs.com/docs/reference/language#attribute-tags) must be nested within another tag."
12567
11661
  );
@@ -12584,13 +11678,13 @@ var attribute_tag_default = {
12584
11678
  };
12585
11679
 
12586
11680
  // src/translator/visitors/tag/custom-tag.ts
12587
- var import_compiler63 = require("@marko/compiler");
12588
- var import_babel_utils51 = require("@marko/compiler/babel-utils");
11681
+ var import_compiler60 = require("@marko/compiler");
11682
+ var import_babel_utils49 = require("@marko/compiler/babel-utils");
12589
11683
  var import_path4 = __toESM(require("path"));
12590
11684
  var custom_tag_default = {
12591
11685
  analyze: {
12592
11686
  enter(tag) {
12593
- const templateFile = (0, import_babel_utils51.getTagTemplate)(tag);
11687
+ const templateFile = (0, import_babel_utils49.getTagTemplate)(tag);
12594
11688
  if (!templateFile) {
12595
11689
  const tagName = getTagName(tag);
12596
11690
  if (tagName && tag.scope.hasBinding(tagName)) {
@@ -12602,12 +11696,12 @@ var custom_tag_default = {
12602
11696
  `Unable to find entry point for [custom tag](https://markojs.com/docs/reference/custom-tag#relative-custom-tags) \`<${tagName}>\`.`
12603
11697
  );
12604
11698
  }
12605
- (0, import_babel_utils51.assertAttributesOrSingleArg)(tag);
12606
- const childFile = (0, import_babel_utils51.loadFileForTag)(tag);
11699
+ (0, import_babel_utils49.assertAttributesOrSingleArg)(tag);
11700
+ const childFile = (0, import_babel_utils49.loadFileForTag)(tag);
12607
11701
  if (!childFile) {
12608
11702
  throw tag.get("name").buildCodeFrameError("Unable to resolve file for tag.");
12609
11703
  }
12610
- const programSection = (0, import_babel_utils51.getProgram)().node.extra.section;
11704
+ const programSection = (0, import_babel_utils49.getProgram)().node.extra.section;
12611
11705
  const childProgram = childFile.ast.program;
12612
11706
  const childExtra = childProgram.extra;
12613
11707
  const childSection = childExtra.section;
@@ -12635,12 +11729,12 @@ var custom_tag_default = {
12635
11729
  };
12636
11730
  function translateHTML(tag) {
12637
11731
  const { node } = tag;
12638
- const childProgram = (0, import_babel_utils51.loadFileForTag)(tag).ast.program;
11732
+ const childProgram = (0, import_babel_utils49.loadFileForTag)(tag).ast.program;
12639
11733
  const childExtra = childProgram.extra;
12640
11734
  let tagIdentifier;
12641
- if (import_compiler63.types.isStringLiteral(node.name)) {
11735
+ if (import_compiler60.types.isStringLiteral(node.name)) {
12642
11736
  const relativePath = getTagRelativePath(tag);
12643
- tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler63.types.identifier(getTemplateContentName()) : (0, import_babel_utils51.importDefault)(tag.hub.file, relativePath, getTagName(tag));
11737
+ tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler60.types.identifier(getTemplateContentName()) : (0, import_babel_utils49.importDefault)(tag.hub.file, relativePath, getTagName(tag));
12644
11738
  } else {
12645
11739
  tagIdentifier = node.name;
12646
11740
  }
@@ -12656,12 +11750,12 @@ function translateDOM(tag) {
12656
11750
  const { file } = tag.hub;
12657
11751
  const write = writeTo(tag);
12658
11752
  const relativePath = getTagRelativePath(tag);
12659
- const programSection = (0, import_babel_utils51.getProgram)().node.extra.section;
12660
- const childFile = (0, import_babel_utils51.loadFileForTag)(tag);
11753
+ const programSection = (0, import_babel_utils49.getProgram)().node.extra.section;
11754
+ const childFile = (0, import_babel_utils49.loadFileForTag)(tag);
12661
11755
  const childExtra = childFile.ast.program.extra;
12662
11756
  const childExports = childExtra.domExports;
12663
11757
  const childSection = childExtra.section;
12664
- const tagName = import_compiler63.types.isIdentifier(node.name) ? node.name.name : import_compiler63.types.isStringLiteral(node.name) ? node.name.value : "tag";
11758
+ const tagName = import_compiler60.types.isIdentifier(node.name) ? node.name.name : import_compiler60.types.isStringLiteral(node.name) ? node.name.value : "tag";
12665
11759
  if (programSection === childSection) {
12666
11760
  knownTagTranslateDOM(
12667
11761
  tag,
@@ -12672,16 +11766,16 @@ function translateDOM(tag) {
12672
11766
  "render",
12673
11767
  section,
12674
11768
  void 0,
12675
- import_compiler63.types.expressionStatement(
12676
- import_compiler63.types.callExpression(import_compiler63.types.identifier(childExports.setup), [
11769
+ import_compiler60.types.expressionStatement(
11770
+ import_compiler60.types.callExpression(import_compiler60.types.identifier(childExports.setup), [
12677
11771
  createScopeReadExpression(childBinding, section)
12678
11772
  ])
12679
11773
  )
12680
11774
  );
12681
11775
  }
12682
11776
  );
12683
- write`${import_compiler63.types.identifier(childExports.template)}`;
12684
- injectWalks(tag, tagName, import_compiler63.types.identifier(childExports.walks));
11777
+ write`${import_compiler60.types.identifier(childExports.template)}`;
11778
+ injectWalks(tag, tagName, import_compiler60.types.identifier(childExports.walks));
12685
11779
  } else {
12686
11780
  knownTagTranslateDOM(
12687
11781
  tag,
@@ -12697,8 +11791,8 @@ function translateDOM(tag) {
12697
11791
  "render",
12698
11792
  section,
12699
11793
  void 0,
12700
- import_compiler63.types.expressionStatement(
12701
- import_compiler63.types.callExpression(
11794
+ import_compiler60.types.expressionStatement(
11795
+ import_compiler60.types.callExpression(
12702
11796
  importOrSelfReferenceName(
12703
11797
  file,
12704
11798
  relativePath,
@@ -12711,11 +11805,11 @@ function translateDOM(tag) {
12711
11805
  );
12712
11806
  }
12713
11807
  );
12714
- write`${(0, import_babel_utils51.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
11808
+ write`${(0, import_babel_utils49.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
12715
11809
  injectWalks(
12716
11810
  tag,
12717
11811
  tagName,
12718
- (0, import_babel_utils51.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
11812
+ (0, import_babel_utils49.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
12719
11813
  );
12720
11814
  }
12721
11815
  tag.remove();
@@ -12726,9 +11820,9 @@ function getTagRelativePath(tag) {
12726
11820
  hub: { file }
12727
11821
  } = tag;
12728
11822
  let relativePath;
12729
- if (import_compiler63.types.isStringLiteral(node.name)) {
12730
- const template = (0, import_babel_utils51.getTagTemplate)(tag);
12731
- relativePath = template && (0, import_babel_utils51.resolveRelativePath)(file, template);
11823
+ if (import_compiler60.types.isStringLiteral(node.name)) {
11824
+ const template = (0, import_babel_utils49.getTagTemplate)(tag);
11825
+ relativePath = template && (0, import_babel_utils49.resolveRelativePath)(file, template);
12732
11826
  } else if (node.extra?.tagNameImported) {
12733
11827
  relativePath = node.extra.tagNameImported;
12734
11828
  }
@@ -12747,9 +11841,9 @@ function getTagRelativePath(tag) {
12747
11841
  }
12748
11842
  function importOrSelfReferenceName(file, request, name2, nameHint) {
12749
11843
  if (isCircularRequest(file, request)) {
12750
- return import_compiler63.types.identifier(name2);
11844
+ return import_compiler60.types.identifier(name2);
12751
11845
  }
12752
- return (0, import_babel_utils51.importNamed)(file, request, name2, nameHint);
11846
+ return (0, import_babel_utils49.importNamed)(file, request, name2, nameHint);
12753
11847
  }
12754
11848
  function isCircularRequest(file, request) {
12755
11849
  const { filename } = file.opts;
@@ -12757,15 +11851,15 @@ function isCircularRequest(file, request) {
12757
11851
  }
12758
11852
 
12759
11853
  // src/translator/visitors/tag/dynamic-tag.ts
12760
- var import_compiler64 = require("@marko/compiler");
12761
- var import_babel_utils52 = require("@marko/compiler/babel-utils");
11854
+ var import_compiler61 = require("@marko/compiler");
11855
+ var import_babel_utils50 = require("@marko/compiler/babel-utils");
12762
11856
  var kDOMBinding3 = Symbol("dynamic tag dom binding");
12763
11857
  var kChildOffsetScopeBinding2 = Symbol("custom tag scope offset");
12764
11858
  var importedDynamicTagResume = /* @__PURE__ */ new WeakSet();
12765
11859
  var dynamic_tag_default = {
12766
11860
  analyze: {
12767
11861
  enter(tag) {
12768
- (0, import_babel_utils52.assertAttributesOrArgs)(tag);
11862
+ (0, import_babel_utils50.assertAttributesOrArgs)(tag);
12769
11863
  const { node } = tag;
12770
11864
  const definedBodySection = node.extra?.defineBodySection;
12771
11865
  if (definedBodySection) {
@@ -12790,9 +11884,9 @@ var dynamic_tag_default = {
12790
11884
  tagSection
12791
11885
  );
12792
11886
  if (hasVar || tag.node.attributes.some(
12793
- (attr) => import_compiler64.types.isMarkoSpreadAttribute(attr) || isEventOrChangeHandler(attr.name)
11887
+ (attr) => import_compiler61.types.isMarkoSpreadAttribute(attr) || isEventOrChangeHandler(attr.name)
12794
11888
  )) {
12795
- (0, import_babel_utils52.getProgram)().node.extra.isInteractive = true;
11889
+ (0, import_babel_utils50.getProgram)().node.extra.isInteractive = true;
12796
11890
  }
12797
11891
  if (hasVar) {
12798
11892
  trackVarReferences(tag, 5 /* derived */);
@@ -12830,7 +11924,7 @@ var dynamic_tag_default = {
12830
11924
  if (isOutputHTML()) {
12831
11925
  knownTagTranslateHTML(
12832
11926
  tag,
12833
- import_compiler64.types.memberExpression(tag.node.name, import_compiler64.types.identifier("content")),
11927
+ import_compiler61.types.memberExpression(tag.node.name, import_compiler61.types.identifier("content")),
12834
11928
  definedBodySection,
12835
11929
  propTree
12836
11930
  );
@@ -12847,9 +11941,9 @@ var dynamic_tag_default = {
12847
11941
  "render",
12848
11942
  section,
12849
11943
  void 0,
12850
- import_compiler64.types.expressionStatement(
12851
- import_compiler64.types.callExpression(
12852
- import_compiler64.types.memberExpression(signal.identifier, import_compiler64.types.identifier("_")),
11944
+ import_compiler61.types.expressionStatement(
11945
+ import_compiler61.types.callExpression(
11946
+ import_compiler61.types.memberExpression(signal.identifier, import_compiler61.types.identifier("_")),
12853
11947
  [
12854
11948
  createScopeReadExpression(childBinding, section),
12855
11949
  getScopeExpression(section, definedBodySection.parent)
@@ -12874,8 +11968,8 @@ var dynamic_tag_default = {
12874
11968
  const nodeBinding = tagExtra[kDOMBinding3];
12875
11969
  const isClassAPI = tagExtra.featureType === "class";
12876
11970
  let tagExpression = node.name;
12877
- if (import_compiler64.types.isStringLiteral(tagExpression)) {
12878
- tagExpression = (0, import_babel_utils52.importDefault)(
11971
+ if (import_compiler61.types.isStringLiteral(tagExpression)) {
11972
+ tagExpression = (0, import_babel_utils50.importDefault)(
12879
11973
  tag.hub.file,
12880
11974
  getTagRelativePath(tag),
12881
11975
  tagExpression.value
@@ -12883,15 +11977,15 @@ var dynamic_tag_default = {
12883
11977
  }
12884
11978
  if (isClassAPI) {
12885
11979
  if (isOutputHTML()) {
12886
- (0, import_babel_utils52.getProgram)().node.body.push(
12887
- import_compiler64.types.markoScriptlet(
11980
+ (0, import_babel_utils50.getProgram)().node.body.push(
11981
+ import_compiler61.types.markoScriptlet(
12888
11982
  [
12889
- import_compiler64.types.expressionStatement(
12890
- import_compiler64.types.callExpression(
12891
- (0, import_babel_utils52.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
11983
+ import_compiler61.types.expressionStatement(
11984
+ import_compiler61.types.callExpression(
11985
+ (0, import_babel_utils50.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
12892
11986
  [
12893
- import_compiler64.types.identifier(tagExpression.name),
12894
- import_compiler64.types.stringLiteral((0, import_babel_utils52.loadFileForTag)(tag).metadata.marko.id)
11987
+ import_compiler61.types.identifier(tagExpression.name),
11988
+ import_compiler61.types.stringLiteral((0, import_babel_utils50.loadFileForTag)(tag).metadata.marko.id)
12895
11989
  ]
12896
11990
  )
12897
11991
  )
@@ -12900,12 +11994,12 @@ var dynamic_tag_default = {
12900
11994
  )
12901
11995
  );
12902
11996
  } else {
12903
- (0, import_babel_utils52.getProgram)().node.body.push(
12904
- import_compiler64.types.expressionStatement(
11997
+ (0, import_babel_utils50.getProgram)().node.body.push(
11998
+ import_compiler61.types.expressionStatement(
12905
11999
  callRuntime(
12906
12000
  "_resume",
12907
- import_compiler64.types.stringLiteral((0, import_babel_utils52.loadFileForTag)(tag).metadata.marko.id),
12908
- import_compiler64.types.identifier(tagExpression.name)
12001
+ import_compiler61.types.stringLiteral((0, import_babel_utils50.loadFileForTag)(tag).metadata.marko.id),
12002
+ import_compiler61.types.identifier(tagExpression.name)
12909
12003
  )
12910
12004
  )
12911
12005
  );
@@ -12948,9 +12042,9 @@ var dynamic_tag_default = {
12948
12042
  getScopeIdIdentifier(tagSection),
12949
12043
  getScopeAccessorLiteral(nodeBinding),
12950
12044
  tagExpression,
12951
- import_compiler64.types.arrayExpression(args),
12952
- import_compiler64.types.numericLiteral(0),
12953
- import_compiler64.types.numericLiteral(1),
12045
+ import_compiler61.types.arrayExpression(args),
12046
+ import_compiler61.types.numericLiteral(0),
12047
+ import_compiler61.types.numericLiteral(1),
12954
12048
  serializeArg
12955
12049
  ) : callRuntime(
12956
12050
  "_dynamic_tag",
@@ -12958,8 +12052,8 @@ var dynamic_tag_default = {
12958
12052
  getScopeAccessorLiteral(nodeBinding),
12959
12053
  tagExpression,
12960
12054
  args[0],
12961
- args[1] || (serializeArg ? import_compiler64.types.numericLiteral(0) : void 0),
12962
- serializeArg ? import_compiler64.types.numericLiteral(0) : void 0,
12055
+ args[1] || (serializeArg ? import_compiler61.types.numericLiteral(0) : void 0),
12056
+ serializeArg ? import_compiler61.types.numericLiteral(0) : void 0,
12963
12057
  serializeArg
12964
12058
  );
12965
12059
  if (node.var) {
@@ -12967,18 +12061,18 @@ var dynamic_tag_default = {
12967
12061
  tag.get("name").toString() + "_scope"
12968
12062
  );
12969
12063
  statements.push(
12970
- import_compiler64.types.variableDeclaration("const", [
12971
- import_compiler64.types.variableDeclarator(
12064
+ import_compiler61.types.variableDeclaration("const", [
12065
+ import_compiler61.types.variableDeclarator(
12972
12066
  dynamicScopeIdentifier,
12973
12067
  callRuntime("_peek_scope_id")
12974
12068
  )
12975
12069
  ])
12976
12070
  );
12977
12071
  statements.push(
12978
- import_compiler64.types.variableDeclaration("let", [
12979
- import_compiler64.types.variableDeclarator(node.var, dynamicTagExpr)
12072
+ import_compiler61.types.variableDeclaration("let", [
12073
+ import_compiler61.types.variableDeclarator(node.var, dynamicTagExpr)
12980
12074
  ]),
12981
- import_compiler64.types.expressionStatement(
12075
+ import_compiler61.types.expressionStatement(
12982
12076
  callRuntime(
12983
12077
  "_var",
12984
12078
  getScopeIdIdentifier(tagSection),
@@ -12986,7 +12080,7 @@ var dynamic_tag_default = {
12986
12080
  tag.node.extra[kChildOffsetScopeBinding2]
12987
12081
  ),
12988
12082
  dynamicScopeIdentifier,
12989
- import_compiler64.types.stringLiteral(
12083
+ import_compiler61.types.stringLiteral(
12990
12084
  getResumeRegisterId(
12991
12085
  tagSection,
12992
12086
  node.var.extra?.binding,
@@ -12998,7 +12092,7 @@ var dynamic_tag_default = {
12998
12092
  )
12999
12093
  );
13000
12094
  } else {
13001
- statements.push(import_compiler64.types.expressionStatement(dynamicTagExpr));
12095
+ statements.push(import_compiler61.types.expressionStatement(dynamicTagExpr));
13002
12096
  }
13003
12097
  for (const replacement of tag.replaceWithMultiple(statements)) {
13004
12098
  replacement.skip();
@@ -13017,9 +12111,9 @@ var dynamic_tag_default = {
13017
12111
  tagVarSignal.register = true;
13018
12112
  tagVarSignal.buildAssignment = (valueSection, value) => {
13019
12113
  const changeArgs = [
13020
- import_compiler64.types.memberExpression(
12114
+ import_compiler61.types.memberExpression(
13021
12115
  getScopeExpression(tagVarSignal.section, valueSection),
13022
- import_compiler64.types.stringLiteral(
12116
+ import_compiler61.types.stringLiteral(
13023
12117
  getAccessorPrefix().BranchScopes + getScopeAccessor(nodeBinding)
13024
12118
  ),
13025
12119
  true
@@ -13027,28 +12121,28 @@ var dynamic_tag_default = {
13027
12121
  value
13028
12122
  ];
13029
12123
  if (!isOptimize()) {
13030
- changeArgs.push(import_compiler64.types.stringLiteral(varBinding.name));
12124
+ changeArgs.push(import_compiler61.types.stringLiteral(varBinding.name));
13031
12125
  }
13032
- return import_compiler64.types.callExpression(importRuntime("_var_change"), changeArgs);
12126
+ return import_compiler61.types.callExpression(importRuntime("_var_change"), changeArgs);
13033
12127
  };
13034
12128
  }
13035
12129
  signal.build = () => {
13036
12130
  return callRuntime(
13037
12131
  "_dynamic_tag",
13038
12132
  getScopeAccessorLiteral(nodeBinding, true),
13039
- bodySection && import_compiler64.types.identifier(bodySection.name),
13040
- tagVarSignal ? import_compiler64.types.arrowFunctionExpression([], tagVarSignal.identifier) : void 0,
13041
- hasTagArgs && import_compiler64.types.numericLiteral(1)
12133
+ bodySection && import_compiler61.types.identifier(bodySection.name),
12134
+ tagVarSignal ? import_compiler61.types.arrowFunctionExpression([], tagVarSignal.identifier) : void 0,
12135
+ hasTagArgs && import_compiler61.types.numericLiteral(1)
13042
12136
  );
13043
12137
  };
13044
12138
  if (args.length) {
13045
- const argsOrInput = hasTagArgs ? import_compiler64.types.arrayExpression(args) : args[0];
13046
- if (!import_compiler64.types.isObjectExpression(argsOrInput) || argsOrInput.properties.length) {
12139
+ const argsOrInput = hasTagArgs ? import_compiler61.types.arrayExpression(args) : args[0];
12140
+ if (!import_compiler61.types.isObjectExpression(argsOrInput) || argsOrInput.properties.length) {
13047
12141
  signal.extraArgs = [
13048
- import_compiler64.types.arrowFunctionExpression(
12142
+ import_compiler61.types.arrowFunctionExpression(
13049
12143
  [],
13050
- statements.length ? import_compiler64.types.blockStatement(
13051
- statements.concat(import_compiler64.types.returnStatement(argsOrInput))
12144
+ statements.length ? import_compiler61.types.blockStatement(
12145
+ statements.concat(import_compiler61.types.returnStatement(argsOrInput))
13052
12146
  ) : argsOrInput
13053
12147
  )
13054
12148
  ];
@@ -13062,13 +12156,13 @@ var dynamic_tag_default = {
13062
12156
  }
13063
12157
  };
13064
12158
  function enableDynamicTagResume(tag) {
13065
- const program = (0, import_babel_utils52.getProgram)().node;
12159
+ const program = (0, import_babel_utils50.getProgram)().node;
13066
12160
  if (!importedDynamicTagResume.has(program) && analyzeTagNameType(tag, true) !== 1 /* CustomTag */) {
13067
12161
  for (const attr of tag.node.attributes) {
13068
12162
  if (attr.type === "MarkoSpreadAttribute" || attr.type === "MarkoAttribute" && isEventOrChangeHandler(attr.name)) {
13069
12163
  importedDynamicTagResume.add(program);
13070
12164
  program.body.push(
13071
- import_compiler64.types.expressionStatement(callRuntime("_resume_dynamic_tag"))
12165
+ import_compiler61.types.expressionStatement(callRuntime("_resume_dynamic_tag"))
13072
12166
  );
13073
12167
  return;
13074
12168
  }
@@ -13080,7 +12174,7 @@ function enableDynamicTagResume(tag) {
13080
12174
  var tag_default = {
13081
12175
  analyze: {
13082
12176
  enter(tag) {
13083
- const tagDef = (0, import_babel_utils53.getTagDef)(tag);
12177
+ const tagDef = (0, import_babel_utils51.getTagDef)(tag);
13084
12178
  const type = analyzeTagNameType(tag);
13085
12179
  const hook = tagDef?.analyzer?.hook;
13086
12180
  if (hook) {
@@ -13104,7 +12198,7 @@ var tag_default = {
13104
12198
  }
13105
12199
  },
13106
12200
  exit(tag) {
13107
- const hook = (0, import_babel_utils53.getTagDef)(tag)?.analyzer?.hook;
12201
+ const hook = (0, import_babel_utils51.getTagDef)(tag)?.analyzer?.hook;
13108
12202
  if (hook) {
13109
12203
  exit(hook, tag);
13110
12204
  return;
@@ -13113,8 +12207,7 @@ var tag_default = {
13113
12207
  },
13114
12208
  translate: {
13115
12209
  enter(tag) {
13116
- const tagDef = (0, import_babel_utils53.getTagDef)(tag);
13117
- const extra = tag.node.extra;
12210
+ const tagDef = (0, import_babel_utils51.getTagDef)(tag);
13118
12211
  if (tagDef?.translator) {
13119
12212
  if (tagDef.translator.path) {
13120
12213
  tag.hub.file.metadata.marko.watchFiles.push(tagDef.translator.path);
@@ -13130,7 +12223,7 @@ var tag_default = {
13130
12223
  );
13131
12224
  }
13132
12225
  if (attr.node.modifier) {
13133
- if ((0, import_babel_utils53.isNativeTag)(attr.parentPath)) {
12226
+ if ((0, import_babel_utils51.isNativeTag)(attr.parentPath)) {
13134
12227
  attr.node.name += `:${attr.node.modifier}`;
13135
12228
  } else {
13136
12229
  throw attr.buildCodeFrameError(
@@ -13140,18 +12233,7 @@ var tag_default = {
13140
12233
  }
13141
12234
  }
13142
12235
  }
13143
- const type = analyzeTagNameType(tag);
13144
- if (extra.tagNameDynamic && extra.tagNameNullable && type === 0 /* NativeTag */ && !tag.get("name").isIdentifier() && isOutputHTML()) {
13145
- const tagNameId = generateUidIdentifier("tagName");
13146
- const [tagNameVarPath] = tag.insertBefore(
13147
- import_compiler65.types.variableDeclaration("const", [
13148
- import_compiler65.types.variableDeclarator(tagNameId, tag.node.name)
13149
- ])
13150
- );
13151
- tagNameVarPath.skip();
13152
- tag.set("name", tagNameId);
13153
- }
13154
- switch (type) {
12236
+ switch (analyzeTagNameType(tag)) {
13155
12237
  case 0 /* NativeTag */:
13156
12238
  native_tag_default.translate.enter(tag);
13157
12239
  break;
@@ -13167,7 +12249,7 @@ var tag_default = {
13167
12249
  }
13168
12250
  },
13169
12251
  exit(tag) {
13170
- const translator = (0, import_babel_utils53.getTagDef)(tag)?.translator;
12252
+ const translator = (0, import_babel_utils51.getTagDef)(tag)?.translator;
13171
12253
  if (translator) {
13172
12254
  exit(translator.hook, tag);
13173
12255
  return;
@@ -13191,7 +12273,7 @@ var tag_default = {
13191
12273
  };
13192
12274
 
13193
12275
  // src/translator/visitors/text.ts
13194
- var import_compiler66 = require("@marko/compiler");
12276
+ var import_compiler63 = require("@marko/compiler");
13195
12277
  var text_default = {
13196
12278
  translate: {
13197
12279
  exit(text) {
@@ -13223,7 +12305,7 @@ var preferAPI = "tags";
13223
12305
  var { transform, analyze, translate } = visitors;
13224
12306
  var taglibs = [
13225
12307
  [
13226
- __dirname,
12308
+ core_default.taglibId,
13227
12309
  {
13228
12310
  ...core_default,
13229
12311
  migrate: visitors.migrate