marko 6.0.0-next.3.37 → 6.0.0-next.3.39

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.
@@ -628,7 +628,7 @@ function toMemberExpression(object, key, optional) {
628
628
  var pureFunctions = [
629
629
  "conditional",
630
630
  "conditionalClosure",
631
- "conditionalOnlyChild",
631
+ "dynamicTag",
632
632
  "createRenderer",
633
633
  "createRendererWithOwner",
634
634
  "createTemplate",
@@ -2084,13 +2084,26 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
2084
2084
  scopeIdentifier,
2085
2085
  import_compiler17.types.identifier(referencedBindings.name)
2086
2086
  ]);
2087
- signal.isDynamicClosure = isDynamicClosure;
2088
2087
  const intersection = buildSignalIntersections(signal);
2089
- return isDynamicClosure ? callRuntime(
2088
+ return isDynamicClosure ? isStatefulReferences(referencedBindings) ? callRuntime(
2089
+ "registerDynamicClosure",
2090
+ import_compiler17.types.stringLiteral(
2091
+ getResumeRegisterId(
2092
+ section,
2093
+ signal.referencedBindings,
2094
+ "subscriber"
2095
+ )
2096
+ ),
2097
+ getScopeAccessorLiteral(referencedBindings),
2098
+ render,
2099
+ intersection,
2100
+ isImmediateOwner ? void 0 : import_compiler17.types.arrowFunctionExpression([scopeIdentifier], ownerScope)
2101
+ ) : callRuntime(
2090
2102
  "dynamicClosure",
2103
+ getScopeAccessorLiteral(referencedBindings),
2091
2104
  render,
2092
- isImmediateOwner ? null : import_compiler17.types.arrowFunctionExpression([scopeIdentifier], ownerScope),
2093
- intersection
2105
+ intersection,
2106
+ isImmediateOwner ? void 0 : import_compiler17.types.arrowFunctionExpression([scopeIdentifier], ownerScope)
2094
2107
  ) : builder(signal, render, intersection);
2095
2108
  };
2096
2109
  addStatement(
@@ -2100,10 +2113,7 @@ function getSignal(section, referencedBindings, name2 = generateSignalName(refer
2100
2113
  import_compiler17.types.expressionStatement(
2101
2114
  import_compiler17.types.callExpression(
2102
2115
  import_compiler17.types.memberExpression(signal.identifier, import_compiler17.types.identifier("_")),
2103
- [
2104
- scopeIdentifier,
2105
- createScopeReadExpression(section, referencedBindings)
2106
- ]
2116
+ [scopeIdentifier]
2107
2117
  )
2108
2118
  )
2109
2119
  );
@@ -2191,10 +2201,7 @@ function getSignalFn(signal, params, referencedBindings) {
2191
2201
  if (isStatefulReferences(closureSignal.referencedBindings)) {
2192
2202
  signal.render.push(
2193
2203
  import_compiler17.types.expressionStatement(
2194
- import_compiler17.types.callExpression(closureSignal.identifier, [
2195
- scopeIdentifier2,
2196
- valueIdentifier
2197
- ])
2204
+ import_compiler17.types.callExpression(closureSignal.identifier, [scopeIdentifier2])
2198
2205
  )
2199
2206
  );
2200
2207
  }
@@ -2288,7 +2295,7 @@ function generateSignalName(referencedBindings) {
2288
2295
  return name2;
2289
2296
  }
2290
2297
  function finalizeSignalArgs(args) {
2291
- for (let i = args.length - 1; i >= 0; i--) {
2298
+ for (let i = args.length; i--; ) {
2292
2299
  const arg = args[i];
2293
2300
  if (import_compiler17.types.isArrowFunctionExpression(arg) && import_compiler17.types.isBlockStatement(arg.body)) {
2294
2301
  const body = arg.body.body;
@@ -2297,9 +2304,11 @@ function finalizeSignalArgs(args) {
2297
2304
  } else if (body.length === 1 && import_compiler17.types.isExpressionStatement(body[0])) {
2298
2305
  arg.body = toParenthesizedExpressionIfNeeded(body[0].expression);
2299
2306
  }
2307
+ } else if (import_compiler17.types.isNullLiteral(arg) || import_compiler17.types.isUnaryExpression(arg) && arg.operator === "void") {
2308
+ args[i] = import_compiler17.types.numericLiteral(0);
2300
2309
  }
2301
2310
  }
2302
- for (let i = args.length - 1; import_compiler17.types.isNullLiteral(args[i]); ) {
2311
+ for (let i = args.length - 1; import_compiler17.types.isNumericLiteral(args[i]) && args[i].value === 0; ) {
2303
2312
  args.length = i--;
2304
2313
  }
2305
2314
  }
@@ -2437,15 +2446,6 @@ function writeSignals(section) {
2437
2446
  value
2438
2447
  );
2439
2448
  }
2440
- if (signal.isDynamicClosure && isStatefulReferences(signal.referencedBindings)) {
2441
- value = callRuntime(
2442
- "registerSubscriber",
2443
- import_compiler17.types.stringLiteral(
2444
- getResumeRegisterId(section, signal.referencedBindings, "subscriber")
2445
- ),
2446
- value
2447
- );
2448
- }
2449
2449
  const signalDeclarator = import_compiler17.types.variableDeclarator(signal.identifier, value);
2450
2450
  let signalDeclaration = !section.parent && !signal.referencedBindings && (import_compiler17.types.isFunctionExpression(value) || import_compiler17.types.isArrowFunctionExpression(value)) ? import_compiler17.types.functionDeclaration(
2451
2451
  signal.identifier,
@@ -2900,7 +2900,7 @@ var dom_default = {
2900
2900
  import_compiler18.types.variableDeclaration("const", [
2901
2901
  import_compiler18.types.variableDeclarator(
2902
2902
  identifier,
2903
- isStatefulSection(childSection) ? callRuntime(
2903
+ !childSection.isBranch && isStatefulSection(childSection) ? callRuntime(
2904
2904
  "register",
2905
2905
  import_compiler18.types.stringLiteral(
2906
2906
  getResumeRegisterId(childSection, "renderer")
@@ -3973,7 +3973,7 @@ function isStatefulBinding(binding) {
3973
3973
  case 2 /* input */:
3974
3974
  return true;
3975
3975
  default:
3976
- return !binding.upstreamExpression || isStatefulReferences(binding.upstreamExpression.referencedBindings);
3976
+ return binding.upstreamAlias ? isStatefulBinding(binding.upstreamAlias) : !binding.upstreamExpression || isStatefulReferences(binding.upstreamExpression.referencedBindings);
3977
3977
  }
3978
3978
  }
3979
3979
 
@@ -4223,8 +4223,8 @@ var debug_default = {
4223
4223
  };
4224
4224
 
4225
4225
  // src/translator/core/define.ts
4226
- var import_compiler31 = require("@marko/compiler");
4227
- var import_babel_utils20 = require("@marko/compiler/babel-utils");
4226
+ var import_compiler32 = require("@marko/compiler");
4227
+ var import_babel_utils21 = require("@marko/compiler/babel-utils");
4228
4228
 
4229
4229
  // src/translator/util/nested-attribute-tags.ts
4230
4230
  var import_compiler27 = require("@marko/compiler");
@@ -4349,10 +4349,14 @@ function getConditionRoot(tag) {
4349
4349
  }
4350
4350
 
4351
4351
  // src/translator/util/translate-attrs.ts
4352
+ var import_compiler31 = require("@marko/compiler");
4353
+ var import_babel_utils20 = require("@marko/compiler/babel-utils");
4354
+
4355
+ // src/translator/core/for.ts
4352
4356
  var import_compiler30 = require("@marko/compiler");
4353
4357
  var import_babel_utils19 = require("@marko/compiler/babel-utils");
4354
4358
 
4355
- // src/translator/core/for.ts
4359
+ // src/translator/util/is-only-child-in-parent.ts
4356
4360
  var import_compiler29 = require("@marko/compiler");
4357
4361
  var import_babel_utils18 = require("@marko/compiler/babel-utils");
4358
4362
 
@@ -5009,16 +5013,46 @@ function isInvokedFunction(expr) {
5009
5013
  return parent.type === "CallExpression" && parent.callee === node;
5010
5014
  }
5011
5015
 
5012
- // src/translator/core/for.ts
5013
- var kForMarkerBinding = Symbol("for marker binding");
5016
+ // src/translator/util/is-only-child-in-parent.ts
5014
5017
  var kOnlyChildInParent = Symbol("only child in parent");
5018
+ var kNodeRef = Symbol("potential only child node ref");
5019
+ function isOnlyChildInParent(tag, branchSize = 1) {
5020
+ const extra = tag.node.extra;
5021
+ if (extra[kOnlyChildInParent] !== void 0) {
5022
+ return extra[kOnlyChildInParent];
5023
+ }
5024
+ const parentTag = getParentTag(tag);
5025
+ if (parentTag && (0, import_babel_utils18.getTagDef)(parentTag)?.html) {
5026
+ return extra[kOnlyChildInParent] = tag.parent.body.length === branchSize;
5027
+ }
5028
+ return extra[kOnlyChildInParent] = false;
5029
+ }
5030
+ function getOptimizedOnlyChildNodeRef(tag, section, branchSize = 1) {
5031
+ if (isOnlyChildInParent(tag, branchSize)) {
5032
+ const parentTag = getParentTag(tag).node;
5033
+ const parentTagName = parentTag.name?.value;
5034
+ return (parentTag.extra ??= {})[kNativeTagBinding] ??= createBinding(
5035
+ "#" + parentTagName,
5036
+ 0 /* dom */,
5037
+ section
5038
+ );
5039
+ } else {
5040
+ return (tag.node.extra ??= {})[kNodeRef] ??= createBinding(
5041
+ "#text",
5042
+ 0 /* dom */,
5043
+ section
5044
+ );
5045
+ }
5046
+ }
5047
+
5048
+ // src/translator/core/for.ts
5015
5049
  var for_default = {
5016
5050
  analyze(tag) {
5017
5051
  const tagExtra = tag.node.extra ??= {};
5018
5052
  const isAttrTag = tag.node.body.attributeTags;
5019
5053
  let allowAttrs;
5020
- (0, import_babel_utils18.assertNoVar)(tag);
5021
- (0, import_babel_utils18.assertNoArgs)(tag);
5054
+ (0, import_babel_utils19.assertNoVar)(tag);
5055
+ (0, import_babel_utils19.assertNoArgs)(tag);
5022
5056
  assertNoSpreadAttrs(tag);
5023
5057
  switch (getForType(tag.node)) {
5024
5058
  case "of":
@@ -5038,7 +5072,7 @@ var for_default = {
5038
5072
  if (!isAttrTag) {
5039
5073
  allowAttrs.push("by");
5040
5074
  }
5041
- (0, import_babel_utils18.assertAllowedAttributes)(tag, allowAttrs);
5075
+ (0, import_babel_utils19.assertAllowedAttributes)(tag, allowAttrs);
5042
5076
  if (isAttrTag) return;
5043
5077
  const tagBody = tag.get("body");
5044
5078
  const bodySection = startSection(tagBody);
@@ -5046,26 +5080,12 @@ var for_default = {
5046
5080
  dropReferences(getAllTagReferenceNodes(tag.node));
5047
5081
  return;
5048
5082
  }
5049
- bodySection.isBranch = true;
5050
5083
  const section = getOrCreateSection(tag);
5051
- if (isOnlyChildInParent(tag)) {
5052
- const parentTag = getParentTag(tag).node;
5053
- const parentTagName = parentTag.name?.value;
5054
- (parentTag.extra ??= {})[kNativeTagBinding] ??= createBinding(
5055
- "#" + parentTagName,
5056
- 0 /* dom */,
5057
- section
5058
- );
5059
- } else {
5060
- tagExtra[kForMarkerBinding] = createBinding(
5061
- "#text",
5062
- 0 /* dom */,
5063
- section
5064
- );
5065
- }
5066
5084
  trackParamsReferences(tagBody, 3 /* param */, void 0, tagExtra);
5067
5085
  mergeReferences(section, tag.node, getAllTagReferenceNodes(tag.node));
5086
+ getOptimizedOnlyChildNodeRef(tag, section);
5068
5087
  bodySection.upstreamExpression = tagExtra;
5088
+ bodySection.isBranch = true;
5069
5089
  },
5070
5090
  translate: translateByTarget({
5071
5091
  html: {
@@ -5092,9 +5112,8 @@ var for_default = {
5092
5112
  const { node } = tag;
5093
5113
  const tagExtra = node.extra;
5094
5114
  const isStateful = isStatefulReferences(tagExtra.referencedBindings);
5095
- const parentTag = getParentTag(tag);
5096
5115
  const onlyChildInParentOptimization = isOnlyChildInParent(tag);
5097
- const nodeRef2 = onlyChildInParentOptimization ? parentTag.node.extra[kNativeTagBinding] : tag.node.extra[kForMarkerBinding];
5116
+ const nodeRef2 = getOptimizedOnlyChildNodeRef(tag, tagSection);
5098
5117
  const forAttrs = getKnownAttrValues(node);
5099
5118
  const forType = getForType(node);
5100
5119
  const params = node.body.params;
@@ -5103,8 +5122,8 @@ var for_default = {
5103
5122
  const hasStatefulClosures = checkStatefulClosures(bodySection, true);
5104
5123
  const singleNodeOptimization = bodySection.content === null || bodySection.content.singleChild && bodySection.content.startType !== 4 /* Text */;
5105
5124
  let keyExpression;
5106
- if (singleNodeOptimization && onlyChildInParentOptimization) {
5107
- parentTag.node.extra[kSerializeMarker] = false;
5125
+ if (onlyChildInParentOptimization) {
5126
+ getParentTag(tag).node.extra[kSerializeMarker] = false;
5108
5127
  }
5109
5128
  if (isStateful || hasStatefulClosures) {
5110
5129
  const defaultParamNames = {
@@ -5117,33 +5136,33 @@ var for_default = {
5117
5136
  setForceResumeScope(bodySection);
5118
5137
  for (let i = 0; i <= requiredParamsIndex; i++) {
5119
5138
  const existingParam = params[i];
5120
- if (!existingParam || !import_compiler29.types.isIdentifier(existingParam)) {
5139
+ if (!existingParam || !import_compiler30.types.isIdentifier(existingParam)) {
5121
5140
  const id = params[i] = currentProgramPath.scope.generateUidIdentifier(
5122
5141
  defaultParamNames[i]
5123
5142
  );
5124
5143
  if (existingParam) {
5125
5144
  bodyStatements.unshift(
5126
- import_compiler29.types.variableDeclaration("let", [
5127
- import_compiler29.types.variableDeclarator(existingParam, id)
5145
+ import_compiler30.types.variableDeclaration("let", [
5146
+ import_compiler30.types.variableDeclarator(existingParam, id)
5128
5147
  ])
5129
5148
  );
5130
5149
  }
5131
5150
  }
5132
5151
  }
5133
5152
  if (forAttrs.by) {
5134
- if (import_compiler29.types.isStringLiteral(forAttrs.by)) {
5153
+ if (import_compiler30.types.isStringLiteral(forAttrs.by)) {
5135
5154
  keyExpression = toMemberExpression(
5136
5155
  params[0],
5137
5156
  forAttrs.by.value
5138
5157
  );
5139
- } else if (import_compiler29.types.isFunction(forAttrs.by)) {
5158
+ } else if (import_compiler30.types.isFunction(forAttrs.by)) {
5140
5159
  const byIdentifier = currentProgramPath.scope.generateUidIdentifier("by");
5141
5160
  statements.push(
5142
- import_compiler29.types.variableDeclaration("const", [
5143
- import_compiler29.types.variableDeclarator(byIdentifier, forAttrs.by)
5161
+ import_compiler30.types.variableDeclaration("const", [
5162
+ import_compiler30.types.variableDeclarator(byIdentifier, forAttrs.by)
5144
5163
  ])
5145
5164
  );
5146
- keyExpression = import_compiler29.types.callExpression(
5165
+ keyExpression = import_compiler30.types.callExpression(
5147
5166
  byIdentifier,
5148
5167
  params
5149
5168
  );
@@ -5159,20 +5178,20 @@ var for_default = {
5159
5178
  }
5160
5179
  const forScopesIdentifier = getScopeIdentifier(bodySection);
5161
5180
  getHTMLSectionStatements(tagSection).push(
5162
- import_compiler29.types.variableDeclaration("const", [
5163
- import_compiler29.types.variableDeclarator(
5181
+ import_compiler30.types.variableDeclaration("const", [
5182
+ import_compiler30.types.variableDeclarator(
5164
5183
  forScopesIdentifier,
5165
- import_compiler29.types.newExpression(import_compiler29.types.identifier("Map"), [])
5184
+ import_compiler30.types.newExpression(import_compiler30.types.identifier("Map"), [])
5166
5185
  )
5167
5186
  ])
5168
5187
  );
5169
5188
  if (keyExpression && (isStateful || hasStatefulClosures)) {
5170
5189
  bodyStatements.push(
5171
- import_compiler29.types.expressionStatement(
5172
- import_compiler29.types.callExpression(
5173
- import_compiler29.types.memberExpression(
5190
+ import_compiler30.types.expressionStatement(
5191
+ import_compiler30.types.callExpression(
5192
+ import_compiler30.types.memberExpression(
5174
5193
  getScopeIdentifier(bodySection),
5175
- import_compiler29.types.identifier("set")
5194
+ import_compiler30.types.identifier("set")
5176
5195
  ),
5177
5196
  [
5178
5197
  keyExpression,
@@ -5186,13 +5205,13 @@ var for_default = {
5186
5205
  );
5187
5206
  }
5188
5207
  getSerializedScopeProperties(tagSection).set(
5189
- import_compiler29.types.stringLiteral(
5208
+ import_compiler30.types.stringLiteral(
5190
5209
  getScopeAccessorLiteral(nodeRef2).value + "(" /* LoopScopeMap */
5191
5210
  ),
5192
- import_compiler29.types.conditionalExpression(
5193
- import_compiler29.types.memberExpression(forScopesIdentifier, import_compiler29.types.identifier("size")),
5211
+ import_compiler30.types.conditionalExpression(
5212
+ import_compiler30.types.memberExpression(forScopesIdentifier, import_compiler30.types.identifier("size")),
5194
5213
  forScopesIdentifier,
5195
- import_compiler29.types.identifier("undefined")
5214
+ import_compiler30.types.identifier("undefined")
5196
5215
  )
5197
5216
  );
5198
5217
  }
@@ -5203,7 +5222,7 @@ var for_default = {
5203
5222
  const forTagArgs = getBaseArgsInForTag(forType, forAttrs);
5204
5223
  const forTagHTMLRuntime = isStateful ? forTypeToHTMLResumeRuntime(forType, singleNodeOptimization) : forTypeToRuntime(forType);
5205
5224
  forTagArgs.push(
5206
- import_compiler29.types.arrowFunctionExpression(params, import_compiler29.types.blockStatement(bodyStatements))
5225
+ import_compiler30.types.arrowFunctionExpression(params, import_compiler30.types.blockStatement(bodyStatements))
5207
5226
  );
5208
5227
  if (isStateful) {
5209
5228
  forTagArgs.push(
@@ -5211,11 +5230,11 @@ var for_default = {
5211
5230
  getScopeAccessorLiteral(nodeRef2)
5212
5231
  );
5213
5232
  }
5214
- if (singleNodeOptimization && onlyChildInParentOptimization) {
5215
- forTagArgs.push(import_compiler29.types.numericLiteral(1));
5233
+ if (onlyChildInParentOptimization) {
5234
+ forTagArgs.push(import_compiler30.types.numericLiteral(1));
5216
5235
  }
5217
5236
  statements.push(
5218
- import_compiler29.types.expressionStatement(callRuntime(forTagHTMLRuntime, ...forTagArgs))
5237
+ import_compiler30.types.expressionStatement(callRuntime(forTagHTMLRuntime, ...forTagArgs))
5219
5238
  );
5220
5239
  for (const replacement of tag.replaceWithMultiple(statements)) {
5221
5240
  replacement.skip();
@@ -5245,10 +5264,13 @@ var for_default = {
5245
5264
  const { node } = tag;
5246
5265
  const tagExtra = node.extra;
5247
5266
  const { referencedBindings } = tagExtra;
5248
- const nodeRef2 = isOnlyChildInParent(tag) ? getParentTag(tag).node.extra[kNativeTagBinding] : tag.node.extra[kForMarkerBinding];
5249
- setClosureSignalBuilder(tag, (_closureSignal, render, intersection) => {
5267
+ const nodeRef2 = getOptimizedOnlyChildNodeRef(tag, tagSection);
5268
+ setClosureSignalBuilder(tag, (closureSignal, render, intersection) => {
5250
5269
  return callRuntime(
5251
5270
  "loopClosure",
5271
+ getScopeAccessorLiteral(
5272
+ closureSignal.referencedBindings
5273
+ ),
5252
5274
  getScopeAccessorLiteral(nodeRef2),
5253
5275
  render,
5254
5276
  intersection
@@ -5260,7 +5282,7 @@ var for_default = {
5260
5282
  return callRuntime(
5261
5283
  forTypeToDOMRuntime(forType),
5262
5284
  getScopeAccessorLiteral(nodeRef2),
5263
- import_compiler29.types.identifier(bodySection.name)
5285
+ import_compiler30.types.identifier(bodySection.name)
5264
5286
  );
5265
5287
  };
5266
5288
  const params = node.body.params;
@@ -5294,7 +5316,7 @@ var for_default = {
5294
5316
  tagSection,
5295
5317
  referencedBindings,
5296
5318
  signal,
5297
- import_compiler29.types.arrayExpression(loopArgs)
5319
+ import_compiler30.types.arrayExpression(loopArgs)
5298
5320
  );
5299
5321
  tag.remove();
5300
5322
  }
@@ -5360,11 +5382,11 @@ var for_default = {
5360
5382
  ]
5361
5383
  };
5362
5384
  function buildForRuntimeCall(type, attrs2, params, statements) {
5363
- return import_compiler29.types.expressionStatement(
5385
+ return import_compiler30.types.expressionStatement(
5364
5386
  callRuntime(
5365
5387
  forTypeToRuntime(type),
5366
5388
  ...getBaseArgsInForTag(type, attrs2),
5367
- import_compiler29.types.arrowFunctionExpression(params, import_compiler29.types.blockStatement(statements))
5389
+ import_compiler30.types.arrowFunctionExpression(params, import_compiler30.types.blockStatement(statements))
5368
5390
  )
5369
5391
  );
5370
5392
  }
@@ -5440,22 +5462,11 @@ function getBaseArgsInForTag(type, attrs2) {
5440
5462
  case "to":
5441
5463
  return [
5442
5464
  attrs2.to,
5443
- attrs2.from || import_compiler29.types.numericLiteral(0),
5444
- attrs2.step || import_compiler29.types.numericLiteral(1)
5465
+ attrs2.from || import_compiler30.types.numericLiteral(0),
5466
+ attrs2.step || import_compiler30.types.numericLiteral(1)
5445
5467
  ];
5446
5468
  }
5447
5469
  }
5448
- function isOnlyChildInParent(tag) {
5449
- const extra = tag.node.extra;
5450
- if (extra[kOnlyChildInParent] !== void 0) {
5451
- return extra[kOnlyChildInParent];
5452
- }
5453
- const parentTag = getParentTag(tag);
5454
- if (parentTag && (0, import_babel_utils18.getTagDef)(parentTag)?.html) {
5455
- return extra[kOnlyChildInParent] = tag.parent.body.length === 1;
5456
- }
5457
- return extra[kOnlyChildInParent] = false;
5458
- }
5459
5470
 
5460
5471
  // src/translator/util/translate-attrs.ts
5461
5472
  var contentProps = /* @__PURE__ */ new WeakSet();
@@ -5470,8 +5481,8 @@ function translateAttrs(tag, templateExports, statements = [], contentKey = "con
5470
5481
  seen.add(attrTagMeta.name);
5471
5482
  if (attrTagMeta.dynamic) {
5472
5483
  statements.push(
5473
- import_compiler30.types.variableDeclaration("let", [
5474
- import_compiler30.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta))
5484
+ import_compiler31.types.variableDeclaration("let", [
5485
+ import_compiler31.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta))
5475
5486
  ])
5476
5487
  );
5477
5488
  properties.push(
@@ -5487,7 +5498,7 @@ function translateAttrs(tag, templateExports, statements = [], contentKey = "con
5487
5498
  for (let i = 0; i < attrTags2.length; i++) {
5488
5499
  const child = attrTags2[i];
5489
5500
  if (child.isMarkoTag()) {
5490
- if ((0, import_babel_utils19.isAttributeTag)(child)) {
5501
+ if ((0, import_babel_utils20.isAttributeTag)(child)) {
5491
5502
  const attrTagMeta = attrTagLookup[getTagName(child)];
5492
5503
  if (attrTagMeta.dynamic) {
5493
5504
  i = addDynamicAttrTagStatements(
@@ -5553,8 +5564,8 @@ function translateAttrs(tag, templateExports, statements = [], contentKey = "con
5553
5564
  seen.add(contentKey);
5554
5565
  const contentExpression = buildContent(tag.get("body"));
5555
5566
  if (contentExpression) {
5556
- const contentProp = import_compiler30.types.objectProperty(
5557
- import_compiler30.types.identifier(contentKey),
5567
+ const contentProp = import_compiler31.types.objectProperty(
5568
+ import_compiler31.types.identifier(contentKey),
5558
5569
  contentExpression
5559
5570
  );
5560
5571
  contentProps.add(contentProp);
@@ -5565,8 +5576,8 @@ function translateAttrs(tag, templateExports, statements = [], contentKey = "con
5565
5576
  for (let i = attributes.length; i--; ) {
5566
5577
  const attr2 = attributes[i];
5567
5578
  const { value } = attr2;
5568
- if (import_compiler30.types.isMarkoSpreadAttribute(attr2)) {
5569
- properties.push(import_compiler30.types.spreadElement(value));
5579
+ if (import_compiler31.types.isMarkoSpreadAttribute(attr2)) {
5580
+ properties.push(import_compiler31.types.spreadElement(value));
5570
5581
  } else if (!seen.has(attr2.name) && usesExport(templateExports, attr2.name)) {
5571
5582
  seen.add(attr2.name);
5572
5583
  properties.push(toObjectProperty(attr2.name, value));
@@ -5585,7 +5596,7 @@ function getTranslatedBodyContentProperty(props) {
5585
5596
  function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements, templateExports, contentKey = "content") {
5586
5597
  const tag = attrTags2[index];
5587
5598
  if (tag.isMarkoTag()) {
5588
- if ((0, import_babel_utils19.isAttributeTag)(tag)) {
5599
+ if ((0, import_babel_utils20.isAttributeTag)(tag)) {
5589
5600
  const attrTagMeta = attrTagLookup[getTagName(tag)];
5590
5601
  if (usesExport(templateExports, attrTagMeta.name) && attrTagMeta.dynamic) {
5591
5602
  const translatedAttrTag = translateAttrs(
@@ -5596,8 +5607,8 @@ function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements
5596
5607
  );
5597
5608
  if (attrTagMeta.repeated) {
5598
5609
  statements.push(
5599
- import_compiler30.types.expressionStatement(
5600
- import_compiler30.types.assignmentExpression(
5610
+ import_compiler31.types.expressionStatement(
5611
+ import_compiler31.types.assignmentExpression(
5601
5612
  "=",
5602
5613
  getAttrTagIdentifier(attrTagMeta),
5603
5614
  callRuntime(
@@ -5610,8 +5621,8 @@ function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements
5610
5621
  );
5611
5622
  } else {
5612
5623
  statements.push(
5613
- import_compiler30.types.expressionStatement(
5614
- import_compiler30.types.assignmentExpression(
5624
+ import_compiler31.types.expressionStatement(
5625
+ import_compiler31.types.assignmentExpression(
5615
5626
  "=",
5616
5627
  getAttrTagIdentifier(attrTagMeta),
5617
5628
  callRuntime(
@@ -5650,7 +5661,7 @@ function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements
5650
5661
  return index;
5651
5662
  }
5652
5663
  function propsToExpression(props) {
5653
- return props.length === 1 && import_compiler30.types.isSpreadElement(props[0]) ? props[0].argument : import_compiler30.types.objectExpression(props);
5664
+ return props.length === 1 && import_compiler31.types.isSpreadElement(props[0]) ? props[0].argument : import_compiler31.types.objectExpression(props);
5654
5665
  }
5655
5666
  function translateForAttrTag(attrTags2, index, attrTagLookup, statements, templateExports, contentKey) {
5656
5667
  const forTag = attrTags2[index];
@@ -5675,9 +5686,9 @@ function translateForAttrTag(attrTags2, index, attrTagLookup, statements, templa
5675
5686
  function translateIfAttrTag(attrTags2, index, attrTagLookup, statements, templateExports, contentKey) {
5676
5687
  const ifTag = attrTags2[index];
5677
5688
  const consequentStatements = [];
5678
- let ifStatement = import_compiler30.types.ifStatement(
5689
+ let ifStatement = import_compiler31.types.ifStatement(
5679
5690
  getConditionTestValue(ifTag),
5680
- import_compiler30.types.blockStatement(consequentStatements)
5691
+ import_compiler31.types.blockStatement(consequentStatements)
5681
5692
  );
5682
5693
  statements.push(ifStatement);
5683
5694
  addAllAttrTagsAsDynamic(
@@ -5704,14 +5715,14 @@ function translateIfAttrTag(attrTags2, index, attrTagLookup, statements, templat
5704
5715
  contentKey
5705
5716
  );
5706
5717
  if (testValue) {
5707
- ifStatement.alternate = ifStatement = import_compiler30.types.ifStatement(
5718
+ ifStatement.alternate = ifStatement = import_compiler31.types.ifStatement(
5708
5719
  testValue,
5709
- import_compiler30.types.blockStatement(alternateStatements)
5720
+ import_compiler31.types.blockStatement(alternateStatements)
5710
5721
  );
5711
5722
  nextIndex++;
5712
5723
  continue;
5713
5724
  } else {
5714
- ifStatement.alternate = import_compiler30.types.blockStatement(alternateStatements);
5725
+ ifStatement.alternate = import_compiler31.types.blockStatement(alternateStatements);
5715
5726
  break;
5716
5727
  }
5717
5728
  }
@@ -5769,12 +5780,12 @@ function buildContent(body) {
5769
5780
  "register",
5770
5781
  callRuntime(
5771
5782
  "createRenderer",
5772
- import_compiler30.types.arrowFunctionExpression(
5783
+ import_compiler31.types.arrowFunctionExpression(
5773
5784
  body.node.params,
5774
- import_compiler30.types.blockStatement(body.node.body)
5785
+ import_compiler31.types.blockStatement(body.node.body)
5775
5786
  )
5776
5787
  ),
5777
- import_compiler30.types.stringLiteral(getResumeRegisterId(bodySection, "renderer")),
5788
+ import_compiler31.types.stringLiteral(getResumeRegisterId(bodySection, "renderer")),
5778
5789
  getScopeIdIdentifier(
5779
5790
  getSection(
5780
5791
  getNonAttributeTagParent(body.parentPath)
@@ -5782,7 +5793,7 @@ function buildContent(body) {
5782
5793
  )
5783
5794
  );
5784
5795
  } else {
5785
- return import_compiler30.types.callExpression(import_compiler30.types.identifier(bodySection.name), [
5796
+ return import_compiler31.types.callExpression(import_compiler31.types.identifier(bodySection.name), [
5786
5797
  scopeIdentifier
5787
5798
  ]);
5788
5799
  }
@@ -5790,7 +5801,7 @@ function buildContent(body) {
5790
5801
  }
5791
5802
  function getNonAttributeTagParent(tag) {
5792
5803
  let cur = tag;
5793
- while ((0, import_babel_utils19.isAttributeTag)(cur) || (0, import_babel_utils19.isTransparentTag)(cur)) {
5804
+ while ((0, import_babel_utils20.isAttributeTag)(cur) || (0, import_babel_utils20.isTransparentTag)(cur)) {
5794
5805
  cur = getParentTag(cur);
5795
5806
  }
5796
5807
  return cur;
@@ -5799,7 +5810,7 @@ function getNonAttributeTagParent(tag) {
5799
5810
  // src/translator/core/define.ts
5800
5811
  var define_default = {
5801
5812
  analyze(tag) {
5802
- (0, import_babel_utils20.assertNoArgs)(tag);
5813
+ (0, import_babel_utils21.assertNoArgs)(tag);
5803
5814
  if (!tag.node.var) {
5804
5815
  throw tag.get("name").buildCodeFrameError("The `define` tag requires a tag variable.");
5805
5816
  }
@@ -5861,24 +5872,24 @@ var define_default = {
5861
5872
  };
5862
5873
 
5863
5874
  // src/translator/core/effect.ts
5864
- var import_compiler32 = require("@marko/compiler");
5865
- var import_babel_utils21 = require("@marko/compiler/babel-utils");
5875
+ var import_compiler33 = require("@marko/compiler");
5876
+ var import_babel_utils22 = require("@marko/compiler/babel-utils");
5866
5877
  var effect_default = {
5867
5878
  migrate: [
5868
5879
  (tag) => {
5869
- (0, import_babel_utils21.assertNoArgs)(tag);
5870
- (0, import_babel_utils21.assertNoParams)(tag);
5880
+ (0, import_babel_utils22.assertNoArgs)(tag);
5881
+ (0, import_babel_utils22.assertNoParams)(tag);
5871
5882
  assertNoBodyContent(tag);
5872
- (0, import_babel_utils21.assertNoAttributeTags)(tag);
5883
+ (0, import_babel_utils22.assertNoAttributeTags)(tag);
5873
5884
  assertNoSpreadAttrs(tag);
5874
- (0, import_babel_utils21.assertAllowedAttributes)(tag, ["value"]);
5875
- (0, import_babel_utils21.diagnosticDeprecate)(tag, {
5885
+ (0, import_babel_utils22.assertAllowedAttributes)(tag, ["value"]);
5886
+ (0, import_babel_utils22.diagnosticDeprecate)(tag, {
5876
5887
  label: "The 'effect' tag has been replaced by the 'script' tag.",
5877
5888
  fix() {
5878
5889
  const { node } = tag;
5879
5890
  tag.replaceWith(
5880
- import_compiler32.types.markoTag(
5881
- withPreviousLocation(import_compiler32.types.stringLiteral("script"), node.name),
5891
+ import_compiler33.types.markoTag(
5892
+ withPreviousLocation(import_compiler33.types.stringLiteral("script"), node.name),
5882
5893
  node.attributes,
5883
5894
  node.body,
5884
5895
  node.arguments,
@@ -5895,12 +5906,12 @@ var effect_default = {
5895
5906
  };
5896
5907
 
5897
5908
  // src/translator/core/export.ts
5898
- var import_babel_utils22 = require("@marko/compiler/babel-utils");
5909
+ var import_babel_utils23 = require("@marko/compiler/babel-utils");
5899
5910
  var export_default = {
5900
5911
  parse(tag) {
5901
5912
  const { node } = tag;
5902
5913
  tag.replaceWith(
5903
- (0, import_babel_utils22.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
5914
+ (0, import_babel_utils23.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
5904
5915
  );
5905
5916
  },
5906
5917
  parseOptions: {
@@ -5915,20 +5926,20 @@ var export_default = {
5915
5926
  };
5916
5927
 
5917
5928
  // src/translator/core/html-comment.ts
5918
- var import_compiler33 = require("@marko/compiler");
5919
- var import_babel_utils23 = require("@marko/compiler/babel-utils");
5929
+ var import_compiler34 = require("@marko/compiler");
5930
+ var import_babel_utils24 = require("@marko/compiler/babel-utils");
5920
5931
  var kCommentTagBinding = Symbol("comment tag binding");
5921
5932
  var kGetterId2 = Symbol("node getter id");
5922
5933
  var html_comment_default = {
5923
5934
  analyze(tag) {
5924
- (0, import_babel_utils23.assertNoArgs)(tag);
5925
- (0, import_babel_utils23.assertNoParams)(tag);
5926
- (0, import_babel_utils23.assertNoAttributes)(tag);
5935
+ (0, import_babel_utils24.assertNoArgs)(tag);
5936
+ (0, import_babel_utils24.assertNoParams)(tag);
5937
+ (0, import_babel_utils24.assertNoAttributes)(tag);
5927
5938
  const tagVar = tag.node.var;
5928
5939
  let needsBinding = false;
5929
5940
  let needsGetter = false;
5930
5941
  if (tagVar) {
5931
- if (!import_compiler33.types.isIdentifier(tagVar)) {
5942
+ if (!import_compiler34.types.isIdentifier(tagVar)) {
5932
5943
  throw tag.get("var").buildCodeFrameError(
5933
5944
  "The `html-comment` tag variable cannot be destructured."
5934
5945
  );
@@ -5979,7 +5990,7 @@ var html_comment_default = {
5979
5990
  callRuntime(
5980
5991
  "nodeRef",
5981
5992
  getterId && getScopeIdIdentifier(getSection(tag)),
5982
- getterId && import_compiler33.types.stringLiteral(getterId)
5993
+ getterId && import_compiler34.types.stringLiteral(getterId)
5983
5994
  )
5984
5995
  );
5985
5996
  } else {
@@ -5992,12 +6003,12 @@ var html_comment_default = {
5992
6003
  );
5993
6004
  currentProgramPath.pushContainer(
5994
6005
  "body",
5995
- import_compiler33.types.variableDeclaration("const", [
5996
- import_compiler33.types.variableDeclarator(
6006
+ import_compiler34.types.variableDeclaration("const", [
6007
+ import_compiler34.types.variableDeclarator(
5997
6008
  getterFnIdentifier,
5998
6009
  callRuntime(
5999
6010
  "nodeRef",
6000
- import_compiler33.types.stringLiteral(getterId),
6011
+ import_compiler34.types.stringLiteral(getterId),
6001
6012
  getScopeAccessorLiteral(commentBinding)
6002
6013
  )
6003
6014
  )
@@ -6008,13 +6019,13 @@ var html_comment_default = {
6008
6019
  const referenceSection = getSection(reference);
6009
6020
  if (reference.parentPath?.isCallExpression()) {
6010
6021
  reference.parentPath.replaceWith(
6011
- import_compiler33.types.expressionStatement(
6022
+ import_compiler34.types.expressionStatement(
6012
6023
  createScopeReadExpression(referenceSection, commentBinding)
6013
6024
  )
6014
6025
  );
6015
6026
  } else if (getterFnIdentifier) {
6016
6027
  reference.replaceWith(
6017
- import_compiler33.types.callExpression(getterFnIdentifier, [
6028
+ import_compiler34.types.callExpression(getterFnIdentifier, [
6018
6029
  getScopeExpression(referenceSection, getSection(tag))
6019
6030
  ])
6020
6031
  );
@@ -6030,9 +6041,9 @@ var html_comment_default = {
6030
6041
  write2`<!--`;
6031
6042
  if (isOutputHTML()) {
6032
6043
  for (const child of tag.node.body.body) {
6033
- if (import_compiler33.types.isMarkoText(child)) {
6044
+ if (import_compiler34.types.isMarkoText(child)) {
6034
6045
  write2`${child.value}`;
6035
- } else if (import_compiler33.types.isMarkoPlaceholder(child)) {
6046
+ } else if (import_compiler34.types.isMarkoPlaceholder(child)) {
6036
6047
  write2`${callRuntime("escapeXML", child.value)}`;
6037
6048
  }
6038
6049
  }
@@ -6041,10 +6052,10 @@ var html_comment_default = {
6041
6052
  const templateExpressions = [];
6042
6053
  let currentQuasi = "";
6043
6054
  for (const child of tag.node.body.body) {
6044
- if (import_compiler33.types.isMarkoText(child)) {
6055
+ if (import_compiler34.types.isMarkoText(child)) {
6045
6056
  currentQuasi += child.value;
6046
- } else if (import_compiler33.types.isMarkoPlaceholder(child)) {
6047
- templateQuasis.push(import_compiler33.types.templateElement({ raw: currentQuasi }));
6057
+ } else if (import_compiler34.types.isMarkoPlaceholder(child)) {
6058
+ templateQuasis.push(import_compiler34.types.templateElement({ raw: currentQuasi }));
6048
6059
  templateExpressions.push(child.value);
6049
6060
  currentQuasi = "";
6050
6061
  }
@@ -6052,20 +6063,20 @@ var html_comment_default = {
6052
6063
  if (templateExpressions.length === 0) {
6053
6064
  write2`${currentQuasi}`;
6054
6065
  } else {
6055
- templateQuasis.push(import_compiler33.types.templateElement({ raw: currentQuasi }));
6066
+ templateQuasis.push(import_compiler34.types.templateElement({ raw: currentQuasi }));
6056
6067
  addStatement(
6057
6068
  "render",
6058
6069
  getSection(tag),
6059
6070
  tagExtra.referencedBindings,
6060
- import_compiler33.types.expressionStatement(
6071
+ import_compiler34.types.expressionStatement(
6061
6072
  callRuntime(
6062
6073
  "data",
6063
- import_compiler33.types.memberExpression(
6074
+ import_compiler34.types.memberExpression(
6064
6075
  scopeIdentifier,
6065
6076
  getScopeAccessorLiteral(commentBinding),
6066
6077
  true
6067
6078
  ),
6068
- import_compiler33.types.templateLiteral(templateQuasis, templateExpressions)
6079
+ import_compiler34.types.templateLiteral(templateQuasis, templateExpressions)
6069
6080
  )
6070
6081
  )
6071
6082
  );
@@ -6091,15 +6102,15 @@ var html_comment_default = {
6091
6102
  };
6092
6103
 
6093
6104
  // src/translator/core/html-script.ts
6094
- var import_compiler34 = require("@marko/compiler");
6095
- var import_babel_utils24 = require("@marko/compiler/babel-utils");
6105
+ var import_compiler35 = require("@marko/compiler");
6106
+ var import_babel_utils25 = require("@marko/compiler/babel-utils");
6096
6107
  var kGetterId3 = Symbol("node getter id");
6097
6108
  var html_script_default = {
6098
6109
  analyze(tag) {
6099
- (0, import_babel_utils24.assertNoArgs)(tag);
6100
- (0, import_babel_utils24.assertNoParams)(tag);
6110
+ (0, import_babel_utils25.assertNoArgs)(tag);
6111
+ (0, import_babel_utils25.assertNoParams)(tag);
6101
6112
  const { node } = tag;
6102
- if (node.var && !import_compiler34.types.isIdentifier(node.var)) {
6113
+ if (node.var && !import_compiler35.types.isIdentifier(node.var)) {
6103
6114
  throw tag.get("var").buildCodeFrameError(
6104
6115
  "Tag variables on native elements cannot be destructured."
6105
6116
  );
@@ -6112,7 +6123,7 @@ var html_script_default = {
6112
6123
  let spreadReferenceNodes;
6113
6124
  for (let i = attributes.length; i--; ) {
6114
6125
  const attr2 = attributes[i];
6115
- if (import_compiler34.types.isMarkoAttribute(attr2)) {
6126
+ if (import_compiler35.types.isMarkoAttribute(attr2)) {
6116
6127
  if (seen[attr2.name]) {
6117
6128
  dropReferences(attr2.value);
6118
6129
  continue;
@@ -6124,14 +6135,14 @@ var html_script_default = {
6124
6135
  } else if (!evaluate(attr2.value).confident) {
6125
6136
  hasDynamicAttributes = true;
6126
6137
  }
6127
- } else if (import_compiler34.types.isMarkoSpreadAttribute(attr2)) {
6138
+ } else if (import_compiler35.types.isMarkoSpreadAttribute(attr2)) {
6128
6139
  hasEventHandlers = true;
6129
6140
  hasDynamicAttributes = true;
6130
6141
  (attr2.value.extra ??= {}).isEffect = true;
6131
6142
  }
6132
6143
  if (spreadReferenceNodes) {
6133
6144
  spreadReferenceNodes.push(attr2.value);
6134
- } else if (import_compiler34.types.isMarkoSpreadAttribute(attr2)) {
6145
+ } else if (import_compiler35.types.isMarkoSpreadAttribute(attr2)) {
6135
6146
  spreadReferenceNodes = [attr2.value];
6136
6147
  }
6137
6148
  }
@@ -6141,10 +6152,10 @@ var html_script_default = {
6141
6152
  const bodyPlaceholderNodes = [];
6142
6153
  let hasBodyPlaceholders = false;
6143
6154
  for (const child of tag.node.body.body) {
6144
- if (import_compiler34.types.isMarkoPlaceholder(child)) {
6155
+ if (import_compiler35.types.isMarkoPlaceholder(child)) {
6145
6156
  bodyPlaceholderNodes.push(child.value);
6146
6157
  hasBodyPlaceholders = true;
6147
- } else if (!import_compiler34.types.isMarkoText(child)) {
6158
+ } else if (!import_compiler35.types.isMarkoText(child)) {
6148
6159
  throw tag.hub.buildError(
6149
6160
  child,
6150
6161
  "Invalid child. Only text is allowed inside an html-script."
@@ -6194,7 +6205,7 @@ var html_script_default = {
6194
6205
  let currentSection = getSection(reference);
6195
6206
  while (currentSection !== section && currentSection.parent) {
6196
6207
  getSerializedScopeProperties(currentSection).set(
6197
- import_compiler34.types.stringLiteral("_"),
6208
+ import_compiler35.types.stringLiteral("_"),
6198
6209
  callRuntime(
6199
6210
  "ensureScopeWithId",
6200
6211
  getScopeIdIdentifier(currentSection = currentSection.parent)
@@ -6207,7 +6218,7 @@ var html_script_default = {
6207
6218
  callRuntime(
6208
6219
  "nodeRef",
6209
6220
  getterId && getScopeIdIdentifier(section),
6210
- getterId && import_compiler34.types.stringLiteral(getterId)
6221
+ getterId && import_compiler35.types.stringLiteral(getterId)
6211
6222
  )
6212
6223
  );
6213
6224
  } else {
@@ -6220,12 +6231,12 @@ var html_script_default = {
6220
6231
  );
6221
6232
  currentProgramPath.pushContainer(
6222
6233
  "body",
6223
- import_compiler34.types.variableDeclaration("const", [
6224
- import_compiler34.types.variableDeclarator(
6234
+ import_compiler35.types.variableDeclaration("const", [
6235
+ import_compiler35.types.variableDeclarator(
6225
6236
  getterFnIdentifier,
6226
6237
  callRuntime(
6227
6238
  "nodeRef",
6228
- import_compiler34.types.stringLiteral(getterId),
6239
+ import_compiler35.types.stringLiteral(getterId),
6229
6240
  getScopeAccessorLiteral(nodeRef2)
6230
6241
  )
6231
6242
  )
@@ -6236,13 +6247,13 @@ var html_script_default = {
6236
6247
  const referenceSection = getSection(reference);
6237
6248
  if (reference.parentPath?.isCallExpression()) {
6238
6249
  reference.parentPath.replaceWith(
6239
- import_compiler34.types.expressionStatement(
6250
+ import_compiler35.types.expressionStatement(
6240
6251
  createScopeReadExpression(referenceSection, nodeRef2)
6241
6252
  )
6242
6253
  );
6243
6254
  } else if (getterFnIdentifier) {
6244
6255
  reference.replaceWith(
6245
- import_compiler34.types.callExpression(getterFnIdentifier, [
6256
+ import_compiler35.types.callExpression(getterFnIdentifier, [
6246
6257
  getScopeExpression(referenceSection, getSection(tag))
6247
6258
  ])
6248
6259
  );
@@ -6275,10 +6286,10 @@ var html_script_default = {
6275
6286
  "render",
6276
6287
  section,
6277
6288
  valueReferences,
6278
- import_compiler34.types.expressionStatement(
6289
+ import_compiler35.types.expressionStatement(
6279
6290
  callRuntime(
6280
6291
  helper,
6281
- import_compiler34.types.memberExpression(scopeIdentifier, visitAccessor, true),
6292
+ import_compiler35.types.memberExpression(scopeIdentifier, visitAccessor, true),
6282
6293
  value
6283
6294
  )
6284
6295
  )
@@ -6293,18 +6304,18 @@ var html_script_default = {
6293
6304
  if (isEventHandler(name2)) {
6294
6305
  addHTMLEffectCall(section, valueReferences);
6295
6306
  } else {
6296
- write2`${callRuntime("attr", import_compiler34.types.stringLiteral(name2), value)}`;
6307
+ write2`${callRuntime("attr", import_compiler35.types.stringLiteral(name2), value)}`;
6297
6308
  }
6298
6309
  } else if (isEventHandler(name2)) {
6299
6310
  addStatement(
6300
6311
  "effect",
6301
6312
  section,
6302
6313
  valueReferences,
6303
- import_compiler34.types.expressionStatement(
6314
+ import_compiler35.types.expressionStatement(
6304
6315
  callRuntime(
6305
6316
  "on",
6306
- import_compiler34.types.memberExpression(scopeIdentifier, visitAccessor, true),
6307
- import_compiler34.types.stringLiteral(getEventHandlerName(name2)),
6317
+ import_compiler35.types.memberExpression(scopeIdentifier, visitAccessor, true),
6318
+ import_compiler35.types.stringLiteral(getEventHandlerName(name2)),
6308
6319
  value
6309
6320
  )
6310
6321
  )
@@ -6314,11 +6325,11 @@ var html_script_default = {
6314
6325
  "render",
6315
6326
  section,
6316
6327
  valueReferences,
6317
- import_compiler34.types.expressionStatement(
6328
+ import_compiler35.types.expressionStatement(
6318
6329
  callRuntime(
6319
6330
  "attr",
6320
- import_compiler34.types.memberExpression(scopeIdentifier, visitAccessor, true),
6321
- import_compiler34.types.stringLiteral(name2),
6331
+ import_compiler35.types.memberExpression(scopeIdentifier, visitAccessor, true),
6332
+ import_compiler35.types.stringLiteral(name2),
6322
6333
  value
6323
6334
  )
6324
6335
  )
@@ -6331,9 +6342,9 @@ var html_script_default = {
6331
6342
  if (isHTML) {
6332
6343
  addHTMLEffectCall(section, tagExtra.referencedBindings);
6333
6344
  if (skipExpression) {
6334
- write2`${callRuntime("partialAttrs", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(section), import_compiler34.types.stringLiteral("script"))}`;
6345
+ write2`${callRuntime("partialAttrs", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(section), import_compiler35.types.stringLiteral("script"))}`;
6335
6346
  } else {
6336
- write2`${callRuntime("attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(section), import_compiler34.types.stringLiteral("script"))}`;
6347
+ write2`${callRuntime("attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(section), import_compiler35.types.stringLiteral("script"))}`;
6337
6348
  }
6338
6349
  } else {
6339
6350
  if (skipExpression) {
@@ -6341,7 +6352,7 @@ var html_script_default = {
6341
6352
  "render",
6342
6353
  section,
6343
6354
  tagExtra.referencedBindings,
6344
- import_compiler34.types.expressionStatement(
6355
+ import_compiler35.types.expressionStatement(
6345
6356
  callRuntime(
6346
6357
  "partialAttrs",
6347
6358
  scopeIdentifier,
@@ -6356,7 +6367,7 @@ var html_script_default = {
6356
6367
  "render",
6357
6368
  section,
6358
6369
  tagExtra.referencedBindings,
6359
- import_compiler34.types.expressionStatement(
6370
+ import_compiler35.types.expressionStatement(
6360
6371
  callRuntime(
6361
6372
  "attrs",
6362
6373
  scopeIdentifier,
@@ -6370,7 +6381,7 @@ var html_script_default = {
6370
6381
  "effect",
6371
6382
  section,
6372
6383
  tagExtra.referencedBindings,
6373
- import_compiler34.types.expressionStatement(
6384
+ import_compiler35.types.expressionStatement(
6374
6385
  callRuntime("attrsEvents", scopeIdentifier, visitAccessor)
6375
6386
  ),
6376
6387
  false
@@ -6381,9 +6392,9 @@ var html_script_default = {
6381
6392
  enter2(tag);
6382
6393
  if (isOutputHTML()) {
6383
6394
  for (const child of tag.node.body.body) {
6384
- if (import_compiler34.types.isMarkoText(child)) {
6395
+ if (import_compiler35.types.isMarkoText(child)) {
6385
6396
  write2`${child.value}`;
6386
- } else if (import_compiler34.types.isMarkoPlaceholder(child)) {
6397
+ } else if (import_compiler35.types.isMarkoPlaceholder(child)) {
6387
6398
  write2`${callRuntime("escapeScript", child.value)}`;
6388
6399
  }
6389
6400
  }
@@ -6393,11 +6404,11 @@ var html_script_default = {
6393
6404
  let currentQuasi = "";
6394
6405
  let referencePlaceholder;
6395
6406
  for (const child of tag.node.body.body) {
6396
- if (import_compiler34.types.isMarkoText(child)) {
6407
+ if (import_compiler35.types.isMarkoText(child)) {
6397
6408
  currentQuasi += child.value;
6398
- } else if (import_compiler34.types.isMarkoPlaceholder(child)) {
6409
+ } else if (import_compiler35.types.isMarkoPlaceholder(child)) {
6399
6410
  referencePlaceholder ||= child;
6400
- templateQuasis.push(import_compiler34.types.templateElement({ raw: currentQuasi }));
6411
+ templateQuasis.push(import_compiler35.types.templateElement({ raw: currentQuasi }));
6401
6412
  templateExpressions.push(child.value);
6402
6413
  currentQuasi = "";
6403
6414
  }
@@ -6405,16 +6416,16 @@ var html_script_default = {
6405
6416
  if (!referencePlaceholder) {
6406
6417
  write2`${currentQuasi}`;
6407
6418
  } else {
6408
- templateQuasis.push(import_compiler34.types.templateElement({ raw: currentQuasi }));
6419
+ templateQuasis.push(import_compiler35.types.templateElement({ raw: currentQuasi }));
6409
6420
  addStatement(
6410
6421
  "render",
6411
6422
  getSection(tag),
6412
6423
  referencePlaceholder.value.extra?.referencedBindings,
6413
- import_compiler34.types.expressionStatement(
6424
+ import_compiler35.types.expressionStatement(
6414
6425
  callRuntime(
6415
6426
  "textContent",
6416
- import_compiler34.types.memberExpression(scopeIdentifier, visitAccessor, true),
6417
- import_compiler34.types.templateLiteral(templateQuasis, templateExpressions)
6427
+ import_compiler35.types.memberExpression(scopeIdentifier, visitAccessor, true),
6428
+ import_compiler35.types.templateLiteral(templateQuasis, templateExpressions)
6418
6429
  )
6419
6430
  )
6420
6431
  );
@@ -6453,11 +6464,11 @@ function getUsedAttrs2(tag) {
6453
6464
  for (let i = attributes.length; i--; ) {
6454
6465
  const attr2 = attributes[i];
6455
6466
  const { value } = attr2;
6456
- if (import_compiler34.types.isMarkoSpreadAttribute(attr2)) {
6467
+ if (import_compiler35.types.isMarkoSpreadAttribute(attr2)) {
6457
6468
  if (!spreadProps) {
6458
6469
  spreadProps = [];
6459
6470
  }
6460
- spreadProps.push(import_compiler34.types.spreadElement(value));
6471
+ spreadProps.push(import_compiler35.types.spreadElement(value));
6461
6472
  } else if (!seen[attr2.name]) {
6462
6473
  seen[attr2.name] = attr2;
6463
6474
  if (spreadProps) {
@@ -6471,10 +6482,10 @@ function getUsedAttrs2(tag) {
6471
6482
  if (spreadProps) {
6472
6483
  spreadProps.reverse();
6473
6484
  for (const { name: name2 } of staticAttrs) {
6474
- (skipProps ||= []).push(toObjectProperty(name2, import_compiler34.types.numericLiteral(1)));
6485
+ (skipProps ||= []).push(toObjectProperty(name2, import_compiler35.types.numericLiteral(1)));
6475
6486
  }
6476
6487
  if (skipProps) {
6477
- skipExpression = import_compiler34.types.objectExpression(skipProps);
6488
+ skipExpression = import_compiler35.types.objectExpression(skipProps);
6478
6489
  }
6479
6490
  spreadExpression = propsToExpression(spreadProps);
6480
6491
  }
@@ -6486,15 +6497,15 @@ function getUsedAttrs2(tag) {
6486
6497
  }
6487
6498
 
6488
6499
  // src/translator/core/html-style.ts
6489
- var import_compiler35 = require("@marko/compiler");
6490
- var import_babel_utils25 = require("@marko/compiler/babel-utils");
6500
+ var import_compiler36 = require("@marko/compiler");
6501
+ var import_babel_utils26 = require("@marko/compiler/babel-utils");
6491
6502
  var kGetterId4 = Symbol("node getter id");
6492
6503
  var html_style_default = {
6493
6504
  analyze(tag) {
6494
- (0, import_babel_utils25.assertNoArgs)(tag);
6495
- (0, import_babel_utils25.assertNoParams)(tag);
6505
+ (0, import_babel_utils26.assertNoArgs)(tag);
6506
+ (0, import_babel_utils26.assertNoParams)(tag);
6496
6507
  const { node } = tag;
6497
- if (node.var && !import_compiler35.types.isIdentifier(node.var)) {
6508
+ if (node.var && !import_compiler36.types.isIdentifier(node.var)) {
6498
6509
  throw tag.get("var").buildCodeFrameError(
6499
6510
  "Tag variables on native elements cannot be destructured."
6500
6511
  );
@@ -6507,7 +6518,7 @@ var html_style_default = {
6507
6518
  let spreadReferenceNodes;
6508
6519
  for (let i = attributes.length; i--; ) {
6509
6520
  const attr2 = attributes[i];
6510
- if (import_compiler35.types.isMarkoAttribute(attr2)) {
6521
+ if (import_compiler36.types.isMarkoAttribute(attr2)) {
6511
6522
  if (seen[attr2.name]) {
6512
6523
  dropReferences(attr2.value);
6513
6524
  continue;
@@ -6519,14 +6530,14 @@ var html_style_default = {
6519
6530
  } else if (!evaluate(attr2.value).confident) {
6520
6531
  hasDynamicAttributes = true;
6521
6532
  }
6522
- } else if (import_compiler35.types.isMarkoSpreadAttribute(attr2)) {
6533
+ } else if (import_compiler36.types.isMarkoSpreadAttribute(attr2)) {
6523
6534
  hasEventHandlers = true;
6524
6535
  hasDynamicAttributes = true;
6525
6536
  (attr2.value.extra ??= {}).isEffect = true;
6526
6537
  }
6527
6538
  if (spreadReferenceNodes) {
6528
6539
  spreadReferenceNodes.push(attr2.value);
6529
- } else if (import_compiler35.types.isMarkoSpreadAttribute(attr2)) {
6540
+ } else if (import_compiler36.types.isMarkoSpreadAttribute(attr2)) {
6530
6541
  spreadReferenceNodes = [attr2.value];
6531
6542
  }
6532
6543
  }
@@ -6536,10 +6547,10 @@ var html_style_default = {
6536
6547
  const bodyPlaceholderNodes = [];
6537
6548
  let hasBodyPlaceholders = false;
6538
6549
  for (const child of tag.node.body.body) {
6539
- if (import_compiler35.types.isMarkoPlaceholder(child)) {
6550
+ if (import_compiler36.types.isMarkoPlaceholder(child)) {
6540
6551
  bodyPlaceholderNodes.push(child.value);
6541
6552
  hasBodyPlaceholders = true;
6542
- } else if (!import_compiler35.types.isMarkoText(child)) {
6553
+ } else if (!import_compiler36.types.isMarkoText(child)) {
6543
6554
  throw tag.hub.buildError(
6544
6555
  child,
6545
6556
  "Invalid child. Only text is allowed inside an html-style."
@@ -6589,7 +6600,7 @@ var html_style_default = {
6589
6600
  let currentSection = getSection(reference);
6590
6601
  while (currentSection !== section && currentSection.parent) {
6591
6602
  getSerializedScopeProperties(currentSection).set(
6592
- import_compiler35.types.stringLiteral("_"),
6603
+ import_compiler36.types.stringLiteral("_"),
6593
6604
  callRuntime(
6594
6605
  "ensureScopeWithId",
6595
6606
  getScopeIdIdentifier(currentSection = currentSection.parent)
@@ -6602,7 +6613,7 @@ var html_style_default = {
6602
6613
  callRuntime(
6603
6614
  "nodeRef",
6604
6615
  getterId && getScopeIdIdentifier(section),
6605
- getterId && import_compiler35.types.stringLiteral(getterId)
6616
+ getterId && import_compiler36.types.stringLiteral(getterId)
6606
6617
  )
6607
6618
  );
6608
6619
  } else {
@@ -6615,12 +6626,12 @@ var html_style_default = {
6615
6626
  );
6616
6627
  currentProgramPath.pushContainer(
6617
6628
  "body",
6618
- import_compiler35.types.variableDeclaration("const", [
6619
- import_compiler35.types.variableDeclarator(
6629
+ import_compiler36.types.variableDeclaration("const", [
6630
+ import_compiler36.types.variableDeclarator(
6620
6631
  getterFnIdentifier,
6621
6632
  callRuntime(
6622
6633
  "nodeRef",
6623
- import_compiler35.types.stringLiteral(getterId),
6634
+ import_compiler36.types.stringLiteral(getterId),
6624
6635
  getScopeAccessorLiteral(nodeRef2)
6625
6636
  )
6626
6637
  )
@@ -6631,13 +6642,13 @@ var html_style_default = {
6631
6642
  const referenceSection = getSection(reference);
6632
6643
  if (reference.parentPath?.isCallExpression()) {
6633
6644
  reference.parentPath.replaceWith(
6634
- import_compiler35.types.expressionStatement(
6645
+ import_compiler36.types.expressionStatement(
6635
6646
  createScopeReadExpression(referenceSection, nodeRef2)
6636
6647
  )
6637
6648
  );
6638
6649
  } else if (getterFnIdentifier) {
6639
6650
  reference.replaceWith(
6640
- import_compiler35.types.callExpression(getterFnIdentifier, [
6651
+ import_compiler36.types.callExpression(getterFnIdentifier, [
6641
6652
  getScopeExpression(referenceSection, getSection(tag))
6642
6653
  ])
6643
6654
  );
@@ -6670,10 +6681,10 @@ var html_style_default = {
6670
6681
  "render",
6671
6682
  section,
6672
6683
  valueReferences,
6673
- import_compiler35.types.expressionStatement(
6684
+ import_compiler36.types.expressionStatement(
6674
6685
  callRuntime(
6675
6686
  helper,
6676
- import_compiler35.types.memberExpression(scopeIdentifier, visitAccessor, true),
6687
+ import_compiler36.types.memberExpression(scopeIdentifier, visitAccessor, true),
6677
6688
  value
6678
6689
  )
6679
6690
  )
@@ -6688,18 +6699,18 @@ var html_style_default = {
6688
6699
  if (isEventHandler(name2)) {
6689
6700
  addHTMLEffectCall(section, valueReferences);
6690
6701
  } else {
6691
- write2`${callRuntime("attr", import_compiler35.types.stringLiteral(name2), value)}`;
6702
+ write2`${callRuntime("attr", import_compiler36.types.stringLiteral(name2), value)}`;
6692
6703
  }
6693
6704
  } else if (isEventHandler(name2)) {
6694
6705
  addStatement(
6695
6706
  "effect",
6696
6707
  section,
6697
6708
  valueReferences,
6698
- import_compiler35.types.expressionStatement(
6709
+ import_compiler36.types.expressionStatement(
6699
6710
  callRuntime(
6700
6711
  "on",
6701
- import_compiler35.types.memberExpression(scopeIdentifier, visitAccessor, true),
6702
- import_compiler35.types.stringLiteral(getEventHandlerName(name2)),
6712
+ import_compiler36.types.memberExpression(scopeIdentifier, visitAccessor, true),
6713
+ import_compiler36.types.stringLiteral(getEventHandlerName(name2)),
6703
6714
  value
6704
6715
  )
6705
6716
  )
@@ -6709,11 +6720,11 @@ var html_style_default = {
6709
6720
  "render",
6710
6721
  section,
6711
6722
  valueReferences,
6712
- import_compiler35.types.expressionStatement(
6723
+ import_compiler36.types.expressionStatement(
6713
6724
  callRuntime(
6714
6725
  "attr",
6715
- import_compiler35.types.memberExpression(scopeIdentifier, visitAccessor, true),
6716
- import_compiler35.types.stringLiteral(name2),
6726
+ import_compiler36.types.memberExpression(scopeIdentifier, visitAccessor, true),
6727
+ import_compiler36.types.stringLiteral(name2),
6717
6728
  value
6718
6729
  )
6719
6730
  )
@@ -6726,9 +6737,9 @@ var html_style_default = {
6726
6737
  if (isHTML) {
6727
6738
  addHTMLEffectCall(section, tagExtra.referencedBindings);
6728
6739
  if (skipExpression) {
6729
- write2`${callRuntime("partialAttrs", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(section), import_compiler35.types.stringLiteral("style"))}`;
6740
+ write2`${callRuntime("partialAttrs", spreadExpression, skipExpression, visitAccessor, getScopeIdIdentifier(section), import_compiler36.types.stringLiteral("style"))}`;
6730
6741
  } else {
6731
- write2`${callRuntime("attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(section), import_compiler35.types.stringLiteral("style"))}`;
6742
+ write2`${callRuntime("attrs", spreadExpression, visitAccessor, getScopeIdIdentifier(section), import_compiler36.types.stringLiteral("style"))}`;
6732
6743
  }
6733
6744
  } else {
6734
6745
  if (skipExpression) {
@@ -6736,7 +6747,7 @@ var html_style_default = {
6736
6747
  "render",
6737
6748
  section,
6738
6749
  tagExtra.referencedBindings,
6739
- import_compiler35.types.expressionStatement(
6750
+ import_compiler36.types.expressionStatement(
6740
6751
  callRuntime(
6741
6752
  "partialAttrs",
6742
6753
  scopeIdentifier,
@@ -6751,7 +6762,7 @@ var html_style_default = {
6751
6762
  "render",
6752
6763
  section,
6753
6764
  tagExtra.referencedBindings,
6754
- import_compiler35.types.expressionStatement(
6765
+ import_compiler36.types.expressionStatement(
6755
6766
  callRuntime(
6756
6767
  "attrs",
6757
6768
  scopeIdentifier,
@@ -6765,7 +6776,7 @@ var html_style_default = {
6765
6776
  "effect",
6766
6777
  section,
6767
6778
  tagExtra.referencedBindings,
6768
- import_compiler35.types.expressionStatement(
6779
+ import_compiler36.types.expressionStatement(
6769
6780
  callRuntime("attrsEvents", scopeIdentifier, visitAccessor)
6770
6781
  ),
6771
6782
  false
@@ -6776,9 +6787,9 @@ var html_style_default = {
6776
6787
  enter2(tag);
6777
6788
  if (isOutputHTML()) {
6778
6789
  for (const child of tag.node.body.body) {
6779
- if (import_compiler35.types.isMarkoText(child)) {
6790
+ if (import_compiler36.types.isMarkoText(child)) {
6780
6791
  write2`${child.value}`;
6781
- } else if (import_compiler35.types.isMarkoPlaceholder(child)) {
6792
+ } else if (import_compiler36.types.isMarkoPlaceholder(child)) {
6782
6793
  write2`${callRuntime("escapeStyle", child.value)}`;
6783
6794
  }
6784
6795
  }
@@ -6788,11 +6799,11 @@ var html_style_default = {
6788
6799
  let currentQuasi = "";
6789
6800
  let referencePlaceholder;
6790
6801
  for (const child of tag.node.body.body) {
6791
- if (import_compiler35.types.isMarkoText(child)) {
6802
+ if (import_compiler36.types.isMarkoText(child)) {
6792
6803
  currentQuasi += child.value;
6793
- } else if (import_compiler35.types.isMarkoPlaceholder(child)) {
6804
+ } else if (import_compiler36.types.isMarkoPlaceholder(child)) {
6794
6805
  referencePlaceholder ||= child;
6795
- templateQuasis.push(import_compiler35.types.templateElement({ raw: currentQuasi }));
6806
+ templateQuasis.push(import_compiler36.types.templateElement({ raw: currentQuasi }));
6796
6807
  templateExpressions.push(child.value);
6797
6808
  currentQuasi = "";
6798
6809
  }
@@ -6800,16 +6811,16 @@ var html_style_default = {
6800
6811
  if (!referencePlaceholder) {
6801
6812
  write2`${currentQuasi}`;
6802
6813
  } else {
6803
- templateQuasis.push(import_compiler35.types.templateElement({ raw: currentQuasi }));
6814
+ templateQuasis.push(import_compiler36.types.templateElement({ raw: currentQuasi }));
6804
6815
  addStatement(
6805
6816
  "render",
6806
6817
  getSection(tag),
6807
6818
  referencePlaceholder.value.extra?.referencedBindings,
6808
- import_compiler35.types.expressionStatement(
6819
+ import_compiler36.types.expressionStatement(
6809
6820
  callRuntime(
6810
6821
  "textContent",
6811
- import_compiler35.types.memberExpression(scopeIdentifier, visitAccessor, true),
6812
- import_compiler35.types.templateLiteral(templateQuasis, templateExpressions)
6822
+ import_compiler36.types.memberExpression(scopeIdentifier, visitAccessor, true),
6823
+ import_compiler36.types.templateLiteral(templateQuasis, templateExpressions)
6813
6824
  )
6814
6825
  )
6815
6826
  );
@@ -6843,11 +6854,11 @@ function getUsedAttrs3(tag) {
6843
6854
  for (let i = attributes.length; i--; ) {
6844
6855
  const attr2 = attributes[i];
6845
6856
  const { value } = attr2;
6846
- if (import_compiler35.types.isMarkoSpreadAttribute(attr2)) {
6857
+ if (import_compiler36.types.isMarkoSpreadAttribute(attr2)) {
6847
6858
  if (!spreadProps) {
6848
6859
  spreadProps = [];
6849
6860
  }
6850
- spreadProps.push(import_compiler35.types.spreadElement(value));
6861
+ spreadProps.push(import_compiler36.types.spreadElement(value));
6851
6862
  } else if (!seen[attr2.name]) {
6852
6863
  seen[attr2.name] = attr2;
6853
6864
  if (spreadProps) {
@@ -6861,10 +6872,10 @@ function getUsedAttrs3(tag) {
6861
6872
  if (spreadProps) {
6862
6873
  spreadProps.reverse();
6863
6874
  for (const { name: name2 } of staticAttrs) {
6864
- (skipProps ||= []).push(toObjectProperty(name2, import_compiler35.types.numericLiteral(1)));
6875
+ (skipProps ||= []).push(toObjectProperty(name2, import_compiler36.types.numericLiteral(1)));
6865
6876
  }
6866
6877
  if (skipProps) {
6867
- skipExpression = import_compiler35.types.objectExpression(skipProps);
6878
+ skipExpression = import_compiler36.types.objectExpression(skipProps);
6868
6879
  }
6869
6880
  spreadExpression = propsToExpression(spreadProps);
6870
6881
  }
@@ -6876,20 +6887,20 @@ function getUsedAttrs3(tag) {
6876
6887
  }
6877
6888
 
6878
6889
  // src/translator/core/id.ts
6879
- var import_compiler36 = require("@marko/compiler");
6880
- var import_babel_utils26 = require("@marko/compiler/babel-utils");
6890
+ var import_compiler37 = require("@marko/compiler");
6891
+ var import_babel_utils27 = require("@marko/compiler/babel-utils");
6881
6892
  var id_default = {
6882
6893
  analyze(tag) {
6883
- (0, import_babel_utils26.assertNoArgs)(tag);
6884
- (0, import_babel_utils26.assertNoParams)(tag);
6885
- (0, import_babel_utils26.assertNoAttributes)(tag);
6894
+ (0, import_babel_utils27.assertNoArgs)(tag);
6895
+ (0, import_babel_utils27.assertNoParams)(tag);
6896
+ (0, import_babel_utils27.assertNoAttributes)(tag);
6886
6897
  assertNoBodyContent(tag);
6887
- (0, import_babel_utils26.assertNoAttributeTags)(tag);
6898
+ (0, import_babel_utils27.assertNoAttributeTags)(tag);
6888
6899
  const { node } = tag;
6889
6900
  if (!node.var) {
6890
6901
  throw tag.get("name").buildCodeFrameError("The `id` tag requires a tag variable.");
6891
6902
  }
6892
- if (!import_compiler36.types.isIdentifier(node.var)) {
6903
+ if (!import_compiler37.types.isIdentifier(node.var)) {
6893
6904
  throw tag.get("var").buildCodeFrameError("The `id` tag cannot be destructured");
6894
6905
  }
6895
6906
  trackVarReferences(tag, 4 /* derived */);
@@ -6900,7 +6911,7 @@ var id_default = {
6900
6911
  const id = isOutputHTML() ? callRuntime("nextTagId") : callRuntime("nextTagId", scopeIdentifier);
6901
6912
  if (isOutputHTML()) {
6902
6913
  tag.replaceWith(
6903
- import_compiler36.types.variableDeclaration("const", [import_compiler36.types.variableDeclarator(node.var, id)])
6914
+ import_compiler37.types.variableDeclaration("const", [import_compiler37.types.variableDeclarator(node.var, id)])
6904
6915
  );
6905
6916
  } else {
6906
6917
  const source = initValue(node.var.extra.binding);
@@ -6925,23 +6936,22 @@ var id_default = {
6925
6936
  };
6926
6937
 
6927
6938
  // src/translator/core/if.ts
6928
- var import_compiler38 = require("@marko/compiler");
6929
- var import_babel_utils27 = require("@marko/compiler/babel-utils");
6939
+ var import_compiler39 = require("@marko/compiler");
6940
+ var import_babel_utils28 = require("@marko/compiler/babel-utils");
6930
6941
 
6931
6942
  // src/translator/util/to-first-statement-or-block.ts
6932
- var import_compiler37 = require("@marko/compiler");
6943
+ var import_compiler38 = require("@marko/compiler");
6933
6944
  function toFirstStatementOrBlock(body) {
6934
6945
  if (Array.isArray(body)) {
6935
6946
  if (body.length === 1) {
6936
6947
  return body[0];
6937
6948
  }
6938
- return import_compiler37.types.blockStatement(body);
6949
+ return import_compiler38.types.blockStatement(body);
6939
6950
  }
6940
6951
  return body;
6941
6952
  }
6942
6953
 
6943
6954
  // src/translator/core/if.ts
6944
- var kBinding = Symbol("if node binding");
6945
6955
  var BRANCHES_LOOKUP = /* @__PURE__ */ new WeakMap();
6946
6956
  var IfTag = {
6947
6957
  analyze(tag) {
@@ -6966,15 +6976,9 @@ var IfTag = {
6966
6976
  }
6967
6977
  }
6968
6978
  const section = getOrCreateSection(tag);
6969
- rootExtra[kBinding] = createBinding(
6970
- "#text",
6971
- 0 /* dom */,
6972
- section,
6973
- void 0,
6974
- rootExtra
6975
- );
6976
- rootExtra.singleNodeOptimization = singleNodeOptimization;
6977
6979
  mergeReferences(section, rootTag.node, mergeReferenceNodes);
6980
+ getOptimizedOnlyChildNodeRef(rootTag, section, branches.length);
6981
+ rootExtra.singleNodeOptimization = singleNodeOptimization;
6978
6982
  }
6979
6983
  },
6980
6984
  translate: translateByTarget({
@@ -6983,10 +6987,10 @@ var IfTag = {
6983
6987
  if (tag.node.body.attributeTags) return;
6984
6988
  const tagBody = tag.get("body");
6985
6989
  const bodySection = getSectionForBody(tagBody);
6986
- if (isRoot(tag)) {
6990
+ if (isRoot(tag) && !isOnlyChildInParent(tag)) {
6987
6991
  visit(tag, 37 /* Replace */);
6992
+ enterShallow(tag);
6988
6993
  }
6989
- enterShallow(tag);
6990
6994
  flushBefore(tag);
6991
6995
  if (bodySection) {
6992
6996
  setSectionParentIsOwner(bodySection, true);
@@ -6998,8 +7002,8 @@ var IfTag = {
6998
7002
  const section = getSection(tag);
6999
7003
  const bodySection = getSectionForBody(tagBody);
7000
7004
  const [isLast, branches] = getBranches(tag, bodySection);
7001
- const rootExtra = branches[0][0].node.extra;
7002
- const nodeRef2 = rootExtra[kBinding];
7005
+ const [rootTag] = branches[0];
7006
+ const rootExtra = rootTag.node.extra;
7003
7007
  const isStateful = isStatefulReferences(rootExtra.referencedBindings);
7004
7008
  const singleNodeOptimization = rootExtra.singleNodeOptimization;
7005
7009
  const hasStatefulClosures = bodySection && checkStatefulClosures(bodySection, true);
@@ -7013,10 +7017,15 @@ var IfTag = {
7013
7017
  writeHTMLResumeStatements(tagBody);
7014
7018
  }
7015
7019
  if (isLast) {
7020
+ const nodeRef2 = getOptimizedOnlyChildNodeRef(rootTag, section);
7021
+ const onlyChildInParentOptimization = isOnlyChildInParent(rootTag);
7016
7022
  const nextTag = tag.getNextSibling();
7017
- const ifScopeIdIdentifier = tag.scope.generateUidIdentifier("ifScopeId");
7018
- const ifRendererIdentifier = tag.scope.generateUidIdentifier("ifRenderer");
7023
+ const ifScopeIdIdentifier = rootTag.scope.generateUidIdentifier("ifScopeId");
7024
+ const ifBranchIdentifier = rootTag.scope.generateUidIdentifier("ifBranch");
7019
7025
  let statement;
7026
+ if (onlyChildInParentOptimization) {
7027
+ getParentTag(rootTag).node.extra[kSerializeMarker] = false;
7028
+ }
7020
7029
  for (let i = branches.length; i--; ) {
7021
7030
  const [branchTag, branchBodySection] = branches[i];
7022
7031
  const bodyStatements = branchTag.node.body.body;
@@ -7027,28 +7036,19 @@ var IfTag = {
7027
7036
  );
7028
7037
  if (isStateful) {
7029
7038
  bodyStatements.push(
7030
- import_compiler38.types.expressionStatement(
7031
- callRuntime(
7032
- "register",
7033
- import_compiler38.types.assignmentExpression(
7034
- "=",
7035
- ifRendererIdentifier,
7036
- callRuntime(
7037
- "createRenderer",
7038
- import_compiler38.types.arrowFunctionExpression([], import_compiler38.types.blockStatement([]))
7039
- )
7040
- ),
7041
- import_compiler38.types.stringLiteral(
7042
- getResumeRegisterId(branchBodySection, "renderer")
7043
- )
7039
+ import_compiler39.types.expressionStatement(
7040
+ import_compiler39.types.assignmentExpression(
7041
+ "=",
7042
+ ifBranchIdentifier,
7043
+ import_compiler39.types.numericLiteral(i)
7044
7044
  )
7045
7045
  )
7046
7046
  );
7047
7047
  }
7048
7048
  if (isStateful || branchHasStatefulClosures) {
7049
7049
  bodyStatements.push(
7050
- import_compiler38.types.expressionStatement(
7051
- import_compiler38.types.assignmentExpression(
7050
+ import_compiler39.types.expressionStatement(
7051
+ import_compiler39.types.assignmentExpression(
7052
7052
  "=",
7053
7053
  ifScopeIdIdentifier,
7054
7054
  getScopeIdIdentifier(branchBodySection)
@@ -7060,7 +7060,7 @@ var IfTag = {
7060
7060
  const [testAttr] = branchTag.node.attributes;
7061
7061
  const curStatement = toFirstStatementOrBlock(bodyStatements);
7062
7062
  if (testAttr) {
7063
- statement = import_compiler38.types.ifStatement(
7063
+ statement = import_compiler39.types.ifStatement(
7064
7064
  testAttr.value,
7065
7065
  curStatement,
7066
7066
  statement
@@ -7075,21 +7075,22 @@ var IfTag = {
7075
7075
  } else {
7076
7076
  if (isStateful) {
7077
7077
  getSerializedScopeProperties(section).set(
7078
- import_compiler38.types.stringLiteral(
7078
+ import_compiler39.types.stringLiteral(
7079
7079
  getScopeAccessorLiteral(nodeRef2).value + "(" /* ConditionalRenderer */
7080
7080
  ),
7081
- ifRendererIdentifier
7081
+ ifBranchIdentifier
7082
7082
  );
7083
- const cbNode = import_compiler38.types.arrowFunctionExpression(
7083
+ const cbNode = import_compiler39.types.arrowFunctionExpression(
7084
7084
  [],
7085
- import_compiler38.types.blockStatement([statement])
7085
+ import_compiler39.types.blockStatement([statement])
7086
7086
  );
7087
- statement = import_compiler38.types.expressionStatement(
7087
+ statement = import_compiler39.types.expressionStatement(
7088
7088
  singleNodeOptimization ? callRuntime(
7089
7089
  "resumeSingleNodeConditional",
7090
7090
  cbNode,
7091
7091
  getScopeIdIdentifier(section),
7092
- getScopeAccessorLiteral(nodeRef2)
7092
+ getScopeAccessorLiteral(nodeRef2),
7093
+ onlyChildInParentOptimization && import_compiler39.types.numericLiteral(1)
7093
7094
  ) : callRuntime(
7094
7095
  "resumeConditional",
7095
7096
  cbNode,
@@ -7100,16 +7101,16 @@ var IfTag = {
7100
7101
  }
7101
7102
  nextTag.insertBefore(statement);
7102
7103
  getHTMLSectionStatements(section).push(
7103
- import_compiler38.types.variableDeclaration(
7104
+ import_compiler39.types.variableDeclaration(
7104
7105
  "let",
7105
7106
  [
7106
- import_compiler38.types.variableDeclarator(ifScopeIdIdentifier),
7107
- isStateful && import_compiler38.types.variableDeclarator(ifRendererIdentifier)
7107
+ import_compiler39.types.variableDeclarator(ifScopeIdIdentifier),
7108
+ isStateful && import_compiler39.types.variableDeclarator(ifBranchIdentifier)
7108
7109
  ].filter(Boolean)
7109
7110
  )
7110
7111
  );
7111
7112
  getSerializedScopeProperties(section).set(
7112
- import_compiler38.types.stringLiteral(
7113
+ import_compiler39.types.stringLiteral(
7113
7114
  getScopeAccessorLiteral(nodeRef2).value + "!" /* ConditionalScope */
7114
7115
  ),
7115
7116
  callRuntime("getScopeById", ifScopeIdIdentifier)
@@ -7126,10 +7127,10 @@ var IfTag = {
7126
7127
  if (bodySection) {
7127
7128
  setSectionParentIsOwner(bodySection, true);
7128
7129
  }
7129
- if (isRoot(tag)) {
7130
+ if (isRoot(tag) && !isOnlyChildInParent(tag)) {
7130
7131
  visit(tag, 37 /* Replace */);
7132
+ enterShallow(tag);
7131
7133
  }
7132
- enterShallow(tag);
7133
7134
  },
7134
7135
  exit(tag) {
7135
7136
  if (tag.node.body.attributeTags) return;
@@ -7138,38 +7139,43 @@ var IfTag = {
7138
7139
  getSectionForBody(tag.get("body"))
7139
7140
  );
7140
7141
  if (isLast) {
7141
- const section = getSection(tag);
7142
+ const [rootTag] = branches[0];
7143
+ const section = getSection(rootTag);
7142
7144
  const rootExtra = branches[0][0].node.extra;
7143
- const nodeRef2 = rootExtra[kBinding];
7144
- let expr = import_compiler38.types.nullLiteral();
7145
+ const nodeRef2 = getOptimizedOnlyChildNodeRef(rootTag, section);
7146
+ const rendererIdentifiers = [];
7147
+ let expr = import_compiler39.types.numericLiteral(branches.length);
7145
7148
  for (let i = branches.length; i--; ) {
7146
7149
  const [branchTag, branchBodySection] = branches[i];
7147
7150
  const [testAttr] = branchTag.node.attributes;
7148
- const consequent = branchBodySection ? import_compiler38.types.identifier(branchBodySection.name) : import_compiler38.types.numericLiteral(0);
7149
- setClosureSignalBuilder(
7150
- branchTag,
7151
- (_closureSignal, render, intersection) => {
7152
- return callRuntime(
7153
- "conditionalClosure",
7154
- getScopeAccessorLiteral(nodeRef2),
7155
- import_compiler38.types.arrowFunctionExpression(
7156
- [],
7157
- import_compiler38.types.identifier(branchBodySection.name)
7158
- ),
7159
- render,
7160
- intersection
7161
- );
7162
- }
7163
- );
7151
+ const consequent = import_compiler39.types.numericLiteral(branchBodySection ? i : -1);
7152
+ if (branchBodySection) {
7153
+ rendererIdentifiers.push(import_compiler39.types.identifier(branchBodySection.name));
7154
+ setClosureSignalBuilder(
7155
+ branchTag,
7156
+ (closureSignal, render, intersection) => {
7157
+ return callRuntime(
7158
+ "conditionalClosure",
7159
+ getScopeAccessorLiteral(
7160
+ closureSignal.referencedBindings
7161
+ ),
7162
+ getScopeAccessorLiteral(nodeRef2),
7163
+ import_compiler39.types.numericLiteral(i),
7164
+ render,
7165
+ intersection
7166
+ );
7167
+ }
7168
+ );
7169
+ }
7164
7170
  branchTag.remove();
7165
- expr = testAttr ? import_compiler38.types.conditionalExpression(testAttr.value, consequent, expr) : consequent;
7171
+ expr = testAttr ? import_compiler39.types.conditionalExpression(testAttr.value, consequent, expr) : consequent;
7166
7172
  }
7167
7173
  const signal = getSignal(section, nodeRef2, "if");
7168
7174
  signal.build = () => {
7169
7175
  return callRuntime(
7170
7176
  "conditional",
7171
7177
  getScopeAccessorLiteral(nodeRef2),
7172
- getSignalFn(signal, [scopeIdentifier])
7178
+ ...rendererIdentifiers.reverse()
7173
7179
  );
7174
7180
  };
7175
7181
  signal.hasDownstreamIntersections = () => branches.some(([, bodySection]) => bodySection?.closures);
@@ -7207,9 +7213,9 @@ var ElseTag = {
7207
7213
  ]
7208
7214
  };
7209
7215
  function assertValidCondition(tag) {
7210
- (0, import_babel_utils27.assertNoVar)(tag);
7211
- (0, import_babel_utils27.assertNoArgs)(tag);
7212
- (0, import_babel_utils27.assertNoParams)(tag);
7216
+ (0, import_babel_utils28.assertNoVar)(tag);
7217
+ (0, import_babel_utils28.assertNoArgs)(tag);
7218
+ (0, import_babel_utils28.assertNoParams)(tag);
7213
7219
  assertHasBody(tag);
7214
7220
  assertNoSpreadAttrs(tag);
7215
7221
  switch (getTagName(tag)) {
@@ -7245,7 +7251,7 @@ function assertHasBody(tag) {
7245
7251
  function assertHasValueAttribute(tag) {
7246
7252
  const { node } = tag;
7247
7253
  const [valueAttr] = node.attributes;
7248
- if (!import_compiler38.types.isMarkoAttribute(valueAttr) || !valueAttr.default) {
7254
+ if (!import_compiler39.types.isMarkoAttribute(valueAttr) || !valueAttr.default) {
7249
7255
  throw tag.get("name").buildCodeFrameError(`The \`${getTagName(tag)}\` tag requires a value.`);
7250
7256
  }
7251
7257
  if (node.attributes.length > 1) {
@@ -7297,12 +7303,12 @@ function isRoot(tag) {
7297
7303
  }
7298
7304
 
7299
7305
  // src/translator/core/import.ts
7300
- var import_babel_utils28 = require("@marko/compiler/babel-utils");
7306
+ var import_babel_utils29 = require("@marko/compiler/babel-utils");
7301
7307
  var import_default = {
7302
7308
  parse(tag) {
7303
7309
  const { node } = tag;
7304
7310
  tag.replaceWith(
7305
- (0, import_babel_utils28.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
7311
+ (0, import_babel_utils29.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
7306
7312
  );
7307
7313
  },
7308
7314
  parseOptions: {
@@ -7320,8 +7326,8 @@ var import_default = {
7320
7326
  };
7321
7327
 
7322
7328
  // src/translator/core/let.ts
7323
- var import_compiler39 = require("@marko/compiler");
7324
- var import_babel_utils29 = require("@marko/compiler/babel-utils");
7329
+ var import_compiler40 = require("@marko/compiler");
7330
+ var import_babel_utils30 = require("@marko/compiler/babel-utils");
7325
7331
  var let_default = {
7326
7332
  analyze(tag) {
7327
7333
  const { node } = tag;
@@ -7329,7 +7335,7 @@ var let_default = {
7329
7335
  let valueAttr;
7330
7336
  let valueChangeAttr;
7331
7337
  for (const attr2 of node.attributes) {
7332
- if (import_compiler39.types.isMarkoAttribute(attr2)) {
7338
+ if (import_compiler40.types.isMarkoAttribute(attr2)) {
7333
7339
  if (attr2.name === "value") {
7334
7340
  valueAttr = attr2;
7335
7341
  } else if (attr2.name === "valueChange") {
@@ -7350,17 +7356,17 @@ var let_default = {
7350
7356
  }
7351
7357
  }
7352
7358
  }
7353
- (0, import_babel_utils29.assertNoArgs)(tag);
7354
- (0, import_babel_utils29.assertNoParams)(tag);
7359
+ (0, import_babel_utils30.assertNoArgs)(tag);
7360
+ (0, import_babel_utils30.assertNoParams)(tag);
7355
7361
  assertNoBodyContent(tag);
7356
7362
  assertNoSpreadAttrs(tag);
7357
7363
  if (!tagVar) {
7358
7364
  throw tag.get("name").buildCodeFrameError("The `let` tag requires a tag variable.");
7359
7365
  }
7360
- if (!import_compiler39.types.isIdentifier(tagVar)) {
7366
+ if (!import_compiler40.types.isIdentifier(tagVar)) {
7361
7367
  throw tag.get("var").buildCodeFrameError("The `let` tag variable cannot be destructured.");
7362
7368
  }
7363
- if (valueChangeAttr && (0, import_babel_utils29.computeNode)(valueChangeAttr.value)) {
7369
+ if (valueChangeAttr && (0, import_babel_utils30.computeNode)(valueChangeAttr.value)) {
7364
7370
  throw tag.get("attributes").find((attr2) => attr2.node === valueChangeAttr).get("value").buildCodeFrameError(
7365
7371
  "The `let` tag `valueChange` attribute must be a function."
7366
7372
  );
@@ -7376,10 +7382,10 @@ var let_default = {
7376
7382
  const { node } = tag;
7377
7383
  const tagVar = node.var;
7378
7384
  const valueAttr = node.attributes.find(
7379
- (attr2) => import_compiler39.types.isMarkoAttribute(attr2) && (attr2.default || attr2.name === "value")
7380
- ) ?? import_compiler39.types.markoAttribute("value", import_compiler39.types.identifier("undefined"));
7385
+ (attr2) => import_compiler40.types.isMarkoAttribute(attr2) && (attr2.default || attr2.name === "value")
7386
+ ) ?? import_compiler40.types.markoAttribute("value", import_compiler40.types.identifier("undefined"));
7381
7387
  const valueChangeAttr = node.attributes.find(
7382
- (attr2) => import_compiler39.types.isMarkoAttribute(attr2) && attr2.name === "valueChange"
7388
+ (attr2) => import_compiler40.types.isMarkoAttribute(attr2) && attr2.name === "valueChange"
7383
7389
  );
7384
7390
  const section = getSection(tag);
7385
7391
  const binding = tagVar.extra.binding;
@@ -7392,13 +7398,13 @@ var let_default = {
7392
7398
  }
7393
7399
  signal.buildAssignment = (valueSection, value) => {
7394
7400
  const scope = getScopeExpression(valueSection, signal.section);
7395
- return import_compiler39.types.callExpression(signal.identifier, [scope, value]);
7401
+ return import_compiler40.types.callExpression(signal.identifier, [scope, value]);
7396
7402
  };
7397
7403
  } else {
7398
7404
  translateVar(tag, valueAttr.value);
7399
7405
  if (valueChangeAttr) {
7400
7406
  getSerializedScopeProperties(section).set(
7401
- import_compiler39.types.stringLiteral(
7407
+ import_compiler40.types.stringLiteral(
7402
7408
  getScopeAccessorLiteral(binding).value + "@" /* TagVariableChange */
7403
7409
  ),
7404
7410
  valueChangeAttr.value
@@ -7422,14 +7428,14 @@ var let_default = {
7422
7428
  };
7423
7429
 
7424
7430
  // src/translator/core/lifecycle.ts
7425
- var import_compiler40 = require("@marko/compiler");
7426
- var import_babel_utils30 = require("@marko/compiler/babel-utils");
7431
+ var import_compiler41 = require("@marko/compiler");
7432
+ var import_babel_utils31 = require("@marko/compiler/babel-utils");
7427
7433
  var kRef = Symbol("lifecycle attrs reference");
7428
7434
  var lifecycle_default = {
7429
7435
  analyze(tag) {
7430
- (0, import_babel_utils30.assertNoArgs)(tag);
7431
- (0, import_babel_utils30.assertNoVar)(tag);
7432
- (0, import_babel_utils30.assertNoParams)(tag);
7436
+ (0, import_babel_utils31.assertNoArgs)(tag);
7437
+ (0, import_babel_utils31.assertNoVar)(tag);
7438
+ (0, import_babel_utils31.assertNoParams)(tag);
7433
7439
  assertNoBodyContent(tag);
7434
7440
  const { node } = tag;
7435
7441
  const tagExtra = node.extra ??= {};
@@ -7447,7 +7453,7 @@ var lifecycle_default = {
7447
7453
  );
7448
7454
  }
7449
7455
  for (const attr2 of node.attributes) {
7450
- if (import_compiler40.types.isMarkoSpreadAttribute(attr2)) {
7456
+ if (import_compiler41.types.isMarkoSpreadAttribute(attr2)) {
7451
7457
  throw tag.get("name").buildCodeFrameError(
7452
7458
  "The `lifecycle` tag does not support `...spread` attributes."
7453
7459
  );
@@ -7467,7 +7473,7 @@ var lifecycle_default = {
7467
7473
  if (isOutputDOM()) {
7468
7474
  const translatedAttrs = translateAttrs(tag);
7469
7475
  translatedAttrs.statements.push(
7470
- import_compiler40.types.expressionStatement(
7476
+ import_compiler41.types.expressionStatement(
7471
7477
  callRuntime(
7472
7478
  "lifecycle",
7473
7479
  scopeIdentifier,
@@ -7502,19 +7508,19 @@ var lifecycle_default = {
7502
7508
  };
7503
7509
 
7504
7510
  // src/translator/core/log.ts
7505
- var import_compiler41 = require("@marko/compiler");
7506
- var import_babel_utils31 = require("@marko/compiler/babel-utils");
7511
+ var import_compiler42 = require("@marko/compiler");
7512
+ var import_babel_utils32 = require("@marko/compiler/babel-utils");
7507
7513
  var log_default = {
7508
7514
  analyze(tag) {
7509
7515
  const [valueAttr] = tag.node.attributes;
7510
- (0, import_babel_utils31.assertNoArgs)(tag);
7511
- (0, import_babel_utils31.assertNoVar)(tag);
7512
- (0, import_babel_utils31.assertNoParams)(tag);
7516
+ (0, import_babel_utils32.assertNoArgs)(tag);
7517
+ (0, import_babel_utils32.assertNoVar)(tag);
7518
+ (0, import_babel_utils32.assertNoParams)(tag);
7513
7519
  assertNoBodyContent(tag);
7514
7520
  if (!valueAttr) {
7515
7521
  throw tag.get("name").buildCodeFrameError("The `log` tag requires a value.");
7516
7522
  }
7517
- if (tag.node.attributes.length > 1 || !import_compiler41.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
7523
+ if (tag.node.attributes.length > 1 || !import_compiler42.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value") {
7518
7524
  throw tag.get("name").buildCodeFrameError(
7519
7525
  "The `log` tag only supports the `value` attribute."
7520
7526
  );
@@ -7526,9 +7532,9 @@ var log_default = {
7526
7532
  const [valueAttr] = tag.node.attributes;
7527
7533
  const { value } = valueAttr;
7528
7534
  const referencedBindings = value.extra?.referencedBindings;
7529
- const statement = import_compiler41.types.expressionStatement(
7530
- import_compiler41.types.callExpression(
7531
- import_compiler41.types.memberExpression(import_compiler41.types.identifier("console"), import_compiler41.types.identifier("log")),
7535
+ const statement = import_compiler42.types.expressionStatement(
7536
+ import_compiler42.types.callExpression(
7537
+ import_compiler42.types.memberExpression(import_compiler42.types.identifier("console"), import_compiler42.types.identifier("log")),
7532
7538
  [value]
7533
7539
  )
7534
7540
  );
@@ -7554,8 +7560,8 @@ var log_default = {
7554
7560
  };
7555
7561
 
7556
7562
  // src/translator/core/script.ts
7557
- var import_compiler42 = require("@marko/compiler");
7558
- var import_babel_utils32 = require("@marko/compiler/babel-utils");
7563
+ var import_compiler43 = require("@marko/compiler");
7564
+ var import_babel_utils33 = require("@marko/compiler/babel-utils");
7559
7565
  var htmlScriptTagAlternateMsg = " For a native html `script` tag use the `html-script` core tag instead.";
7560
7566
  var script_default = {
7561
7567
  parse(tag) {
@@ -7575,22 +7581,22 @@ var script_default = {
7575
7581
  }
7576
7582
  const start = body[0]?.start;
7577
7583
  const end = body[body.length - 1]?.end;
7578
- const bodyStatements = (0, import_babel_utils32.parseStatements)(tag.hub.file, code, start, end);
7579
- const valueFn = import_compiler42.types.arrowFunctionExpression(
7584
+ const bodyStatements = (0, import_babel_utils33.parseStatements)(tag.hub.file, code, start, end);
7585
+ const valueFn = import_compiler43.types.arrowFunctionExpression(
7580
7586
  [],
7581
- import_compiler42.types.blockStatement(bodyStatements),
7587
+ import_compiler43.types.blockStatement(bodyStatements),
7582
7588
  traverseContains(bodyStatements, isAwaitExpression)
7583
7589
  );
7584
- node.attributes.push(import_compiler42.types.markoAttribute("value", valueFn));
7590
+ node.attributes.push(import_compiler43.types.markoAttribute("value", valueFn));
7585
7591
  node.body.body = [];
7586
7592
  }
7587
7593
  },
7588
7594
  analyze(tag) {
7589
7595
  const { node } = tag;
7590
- (0, import_babel_utils32.assertNoArgs)(tag);
7591
- (0, import_babel_utils32.assertNoParams)(tag);
7596
+ (0, import_babel_utils33.assertNoArgs)(tag);
7597
+ (0, import_babel_utils33.assertNoParams)(tag);
7592
7598
  assertNoBodyContent(tag);
7593
- (0, import_babel_utils32.assertNoAttributeTags)(tag);
7599
+ (0, import_babel_utils33.assertNoAttributeTags)(tag);
7594
7600
  if (node.var) {
7595
7601
  throw tag.hub.buildError(
7596
7602
  node.var,
@@ -7630,28 +7636,28 @@ var script_default = {
7630
7636
  const referencedBindings = value.extra?.referencedBindings;
7631
7637
  if (isOutputDOM()) {
7632
7638
  const { value: value2 } = valueAttr;
7633
- const isFunction2 = import_compiler42.types.isFunctionExpression(value2) || import_compiler42.types.isArrowFunctionExpression(value2);
7639
+ const isFunction2 = import_compiler43.types.isFunctionExpression(value2) || import_compiler43.types.isArrowFunctionExpression(value2);
7634
7640
  let inlineBody = null;
7635
7641
  if (isFunction2 && !(value2.async || value2.generator)) {
7636
- if (import_compiler42.types.isBlockStatement(value2.body)) {
7642
+ if (import_compiler43.types.isBlockStatement(value2.body)) {
7637
7643
  let hasDeclaration = false;
7638
7644
  for (const child of value2.body.body) {
7639
- if (import_compiler42.types.isDeclaration(child)) {
7645
+ if (import_compiler43.types.isDeclaration(child)) {
7640
7646
  hasDeclaration = true;
7641
7647
  break;
7642
7648
  }
7643
7649
  }
7644
7650
  inlineBody = hasDeclaration ? value2.body : value2.body.body;
7645
7651
  } else {
7646
- inlineBody = import_compiler42.types.expressionStatement(value2.body);
7652
+ inlineBody = import_compiler43.types.expressionStatement(value2.body);
7647
7653
  }
7648
7654
  }
7649
7655
  addStatement(
7650
7656
  "effect",
7651
7657
  section,
7652
7658
  referencedBindings,
7653
- inlineBody || import_compiler42.types.expressionStatement(
7654
- import_compiler42.types.callExpression(value2, isFunction2 ? [] : [scopeIdentifier])
7659
+ inlineBody || import_compiler43.types.expressionStatement(
7660
+ import_compiler43.types.callExpression(value2, isFunction2 ? [] : [scopeIdentifier])
7655
7661
  )
7656
7662
  );
7657
7663
  } else {
@@ -7691,8 +7697,8 @@ function isAwaitExpression(node) {
7691
7697
  }
7692
7698
 
7693
7699
  // src/translator/core/server.ts
7694
- var import_compiler43 = require("@marko/compiler");
7695
- var import_babel_utils33 = require("@marko/compiler/babel-utils");
7700
+ var import_compiler44 = require("@marko/compiler");
7701
+ var import_babel_utils34 = require("@marko/compiler/babel-utils");
7696
7702
  var server_default = {
7697
7703
  parse(tag) {
7698
7704
  const {
@@ -7702,11 +7708,11 @@ var server_default = {
7702
7708
  const rawValue = node.rawValue;
7703
7709
  const code = rawValue.replace(/^server\s*/, "").trim();
7704
7710
  const start = node.name.start + (rawValue.length - code.length);
7705
- let body = (0, import_babel_utils33.parseStatements)(file, code, start, start + code.length);
7706
- if (body.length === 1 && import_compiler43.types.isBlockStatement(body[0])) {
7711
+ let body = (0, import_babel_utils34.parseStatements)(file, code, start, start + code.length);
7712
+ if (body.length === 1 && import_compiler44.types.isBlockStatement(body[0])) {
7707
7713
  body = body[0].body;
7708
7714
  }
7709
- tag.replaceWith(import_compiler43.types.markoScriptlet(body, true, "server"));
7715
+ tag.replaceWith(import_compiler44.types.markoScriptlet(body, true, "server"));
7710
7716
  },
7711
7717
  parseOptions: {
7712
7718
  statement: true,
@@ -7722,8 +7728,8 @@ var server_default = {
7722
7728
  };
7723
7729
 
7724
7730
  // src/translator/core/static.ts
7725
- var import_compiler44 = require("@marko/compiler");
7726
- var import_babel_utils34 = require("@marko/compiler/babel-utils");
7731
+ var import_compiler45 = require("@marko/compiler");
7732
+ var import_babel_utils35 = require("@marko/compiler/babel-utils");
7727
7733
  var static_default = {
7728
7734
  parse(tag) {
7729
7735
  const {
@@ -7733,11 +7739,11 @@ var static_default = {
7733
7739
  const rawValue = node.rawValue;
7734
7740
  const code = rawValue.replace(/^static\s*/, "").trim();
7735
7741
  const start = node.name.start + (rawValue.length - code.length);
7736
- let body = (0, import_babel_utils34.parseStatements)(file, code, start, start + code.length);
7737
- if (body.length === 1 && import_compiler44.types.isBlockStatement(body[0])) {
7742
+ let body = (0, import_babel_utils35.parseStatements)(file, code, start, start + code.length);
7743
+ if (body.length === 1 && import_compiler45.types.isBlockStatement(body[0])) {
7738
7744
  body = body[0].body;
7739
7745
  }
7740
- tag.replaceWith(import_compiler44.types.markoScriptlet(body, true));
7746
+ tag.replaceWith(import_compiler45.types.markoScriptlet(body, true));
7741
7747
  },
7742
7748
  parseOptions: {
7743
7749
  statement: true,
@@ -7753,17 +7759,17 @@ var static_default = {
7753
7759
  };
7754
7760
 
7755
7761
  // src/translator/core/style.ts
7756
- var import_compiler45 = require("@marko/compiler");
7757
- var import_babel_utils35 = require("@marko/compiler/babel-utils");
7762
+ var import_compiler46 = require("@marko/compiler");
7763
+ var import_babel_utils36 = require("@marko/compiler/babel-utils");
7758
7764
  var import_magic_string = __toESM(require("magic-string"));
7759
7765
  var import_path3 = __toESM(require("path"));
7760
7766
  var STYLE_EXT_REG = /^style((?:\.[a-zA-Z0-9$_-]+)+)?/;
7761
7767
  var htmlStyleTagAlternateMsg = " For a native html `style` tag use the `html-style` core tag instead.";
7762
7768
  var style_default = {
7763
7769
  analyze(tag) {
7764
- (0, import_babel_utils35.assertNoArgs)(tag);
7765
- (0, import_babel_utils35.assertNoParams)(tag);
7766
- (0, import_babel_utils35.assertNoAttributeTags)(tag);
7770
+ (0, import_babel_utils36.assertNoArgs)(tag);
7771
+ (0, import_babel_utils36.assertNoParams)(tag);
7772
+ (0, import_babel_utils36.assertNoAttributeTags)(tag);
7767
7773
  const { node } = tag;
7768
7774
  const ext = STYLE_EXT_REG.exec(node.rawValue || "")?.[1]?.slice(1);
7769
7775
  for (const attr2 of node.attributes) {
@@ -7802,8 +7808,8 @@ var style_default = {
7802
7808
  }
7803
7809
  const markoText = node.body.body[0];
7804
7810
  const { resolveVirtualDependency } = getMarkoOpts();
7805
- const start = (0, import_babel_utils35.getStart)(file, markoText);
7806
- const end = (0, import_babel_utils35.getEnd)(file, markoText);
7811
+ const start = (0, import_babel_utils36.getStart)(file, markoText);
7812
+ const end = (0, import_babel_utils36.getEnd)(file, markoText);
7807
7813
  let code = markoText.value;
7808
7814
  let map;
7809
7815
  if (resolveVirtualDependency && sourceMaps && start !== null && end !== null) {
@@ -7831,23 +7837,23 @@ var style_default = {
7831
7837
  if (!node.var) {
7832
7838
  currentProgramPath.pushContainer(
7833
7839
  "body",
7834
- import_compiler45.types.importDeclaration([], import_compiler45.types.stringLiteral(importPath))
7840
+ import_compiler46.types.importDeclaration([], import_compiler46.types.stringLiteral(importPath))
7835
7841
  );
7836
- } else if (import_compiler45.types.isIdentifier(node.var)) {
7842
+ } else if (import_compiler46.types.isIdentifier(node.var)) {
7837
7843
  currentProgramPath.pushContainer(
7838
7844
  "body",
7839
- import_compiler45.types.importDeclaration(
7840
- [import_compiler45.types.importDefaultSpecifier(node.var)],
7841
- import_compiler45.types.stringLiteral(importPath)
7845
+ import_compiler46.types.importDeclaration(
7846
+ [import_compiler46.types.importDefaultSpecifier(node.var)],
7847
+ import_compiler46.types.stringLiteral(importPath)
7842
7848
  )
7843
7849
  );
7844
7850
  } else {
7845
7851
  currentProgramPath.pushContainer(
7846
7852
  "body",
7847
- import_compiler45.types.variableDeclaration("const", [
7848
- import_compiler45.types.variableDeclarator(
7853
+ import_compiler46.types.variableDeclaration("const", [
7854
+ import_compiler46.types.variableDeclarator(
7849
7855
  node.var,
7850
- (0, import_babel_utils35.importDefault)(file, importPath, "style")
7856
+ (0, import_babel_utils36.importDefault)(file, importPath, "style")
7851
7857
  )
7852
7858
  ])
7853
7859
  );
@@ -7865,14 +7871,14 @@ var style_default = {
7865
7871
  };
7866
7872
 
7867
7873
  // src/translator/core/try.ts
7868
- var import_compiler46 = require("@marko/compiler");
7869
- var import_babel_utils36 = require("@marko/compiler/babel-utils");
7874
+ var import_compiler47 = require("@marko/compiler");
7875
+ var import_babel_utils37 = require("@marko/compiler/babel-utils");
7870
7876
  var try_default = {
7871
7877
  analyze(tag) {
7872
- (0, import_babel_utils36.assertNoVar)(tag);
7873
- (0, import_babel_utils36.assertNoArgs)(tag);
7874
- (0, import_babel_utils36.assertNoParams)(tag);
7875
- (0, import_babel_utils36.assertNoAttributes)(tag);
7878
+ (0, import_babel_utils37.assertNoVar)(tag);
7879
+ (0, import_babel_utils37.assertNoArgs)(tag);
7880
+ (0, import_babel_utils37.assertNoParams)(tag);
7881
+ (0, import_babel_utils37.assertNoAttributes)(tag);
7876
7882
  assertNoSpreadAttrs(tag);
7877
7883
  analyzeAttributeTags(tag);
7878
7884
  const { node } = tag;
@@ -7899,7 +7905,7 @@ var try_default = {
7899
7905
  writeHTMLResumeStatements(tagBody);
7900
7906
  tag.insertBefore(translatedAttrs.statements);
7901
7907
  tag.replaceWith(
7902
- import_compiler46.types.expressionStatement(
7908
+ import_compiler47.types.expressionStatement(
7903
7909
  callRuntime(
7904
7910
  "tryContent",
7905
7911
  propsToExpression(translatedAttrs.properties)
@@ -8013,8 +8019,8 @@ var document_type_default = {
8013
8019
  };
8014
8020
 
8015
8021
  // src/translator/visitors/function.ts
8016
- var import_compiler47 = require("@marko/compiler");
8017
- var import_babel_utils37 = require("@marko/compiler/babel-utils");
8022
+ var import_compiler48 = require("@marko/compiler");
8023
+ var import_babel_utils38 = require("@marko/compiler/babel-utils");
8018
8024
  var functionIdsBySection = /* @__PURE__ */ new WeakMap();
8019
8025
  var function_default = {
8020
8026
  analyze(fn) {
@@ -8025,14 +8031,14 @@ var function_default = {
8025
8031
  if (markoRoot && (markoRoot.isMarkoPlaceholder() || markoRoot.isMarkoScriptlet() && markoRoot.node.target === "server")) {
8026
8032
  return;
8027
8033
  }
8028
- if (isMarkoAttribute(markoRoot) && ((0, import_babel_utils37.isNativeTag)(markoRoot.parentPath) && /^on[A-Z-]/.test(markoRoot.node.name) || isCoreTagName(markoRoot.parentPath, "script") || isCoreTagName(markoRoot.parentPath, "lifecycle") || isCoreTagName(markoRoot.parentPath, "for"))) {
8034
+ if (isMarkoAttribute(markoRoot) && ((0, import_babel_utils38.isNativeTag)(markoRoot.parentPath) && /^on[A-Z-]/.test(markoRoot.node.name) || isCoreTagName(markoRoot.parentPath, "script") || isCoreTagName(markoRoot.parentPath, "lifecycle") || isCoreTagName(markoRoot.parentPath, "for"))) {
8029
8035
  return;
8030
8036
  }
8031
8037
  const { node } = fn;
8032
8038
  const extra = node.extra ??= {};
8033
- const name2 = extra.name = fn.node.id?.name || (isMarkoAttribute(markoRoot) ? markoRoot.node.default ? import_compiler47.types.toIdentifier(
8039
+ const name2 = extra.name = fn.node.id?.name || (isMarkoAttribute(markoRoot) ? markoRoot.node.default ? import_compiler48.types.toIdentifier(
8034
8040
  markoRoot.parentPath.has("var") ? markoRoot.parentPath.get("var") : markoRoot.parentPath.get("name")
8035
- ) : markoRoot.node.name : import_compiler47.types.isVariableDeclarator(fn.parent) && import_compiler47.types.isIdentifier(fn.parent.id) ? fn.parent.id.name : import_compiler47.types.isObjectMethod(node) && import_compiler47.types.isIdentifier(node.key) ? node.key.name : "anonymous");
8041
+ ) : markoRoot.node.name : import_compiler48.types.isVariableDeclarator(fn.parent) && import_compiler48.types.isIdentifier(fn.parent.id) ? fn.parent.id.name : import_compiler48.types.isObjectMethod(node) && import_compiler48.types.isIdentifier(node.key) ? node.key.name : "anonymous");
8036
8042
  const {
8037
8043
  markoOpts,
8038
8044
  opts: { filename }
@@ -8052,7 +8058,7 @@ var function_default = {
8052
8058
  id = `_${index}`;
8053
8059
  }
8054
8060
  extra.section = section;
8055
- extra.registerId = (0, import_babel_utils37.getTemplateId)(
8061
+ extra.registerId = (0, import_babel_utils38.getTemplateId)(
8056
8062
  markoOpts,
8057
8063
  filename,
8058
8064
  `${section.id}/${name2 + id}`
@@ -8064,13 +8070,13 @@ function isMarkoAttribute(path5) {
8064
8070
  }
8065
8071
 
8066
8072
  // src/translator/visitors/import-declaration.ts
8067
- var import_babel_utils38 = require("@marko/compiler/babel-utils");
8073
+ var import_babel_utils39 = require("@marko/compiler/babel-utils");
8068
8074
  var import_declaration_default = {
8069
8075
  analyze(importDecl) {
8070
8076
  const { node } = importDecl;
8071
8077
  const { source } = node;
8072
8078
  const { value } = source;
8073
- const tagImport = (0, import_babel_utils38.resolveTagImport)(importDecl, value);
8079
+ const tagImport = (0, import_babel_utils39.resolveTagImport)(importDecl, value);
8074
8080
  if (tagImport) {
8075
8081
  node.extra ??= {};
8076
8082
  node.extra.tagImport = tagImport;
@@ -8093,15 +8099,15 @@ var import_declaration_default = {
8093
8099
  };
8094
8100
 
8095
8101
  // src/translator/visitors/placeholder.ts
8096
- var import_compiler48 = require("@marko/compiler");
8097
- var kBinding2 = Symbol("placeholder node binding");
8102
+ var import_compiler49 = require("@marko/compiler");
8103
+ var kBinding = Symbol("placeholder node binding");
8098
8104
  var kSiblingText = Symbol("placeholder has sibling text");
8099
8105
  var placeholder_default = {
8100
8106
  analyze(placeholder) {
8101
8107
  const { node } = placeholder;
8102
8108
  const { confident, computed } = evaluate(node.value);
8103
8109
  if (!(confident && (node.escape || isVoid2(computed)))) {
8104
- (node.extra ??= {})[kBinding2] = createBinding(
8110
+ (node.extra ??= {})[kBinding] = createBinding(
8105
8111
  "#text",
8106
8112
  0 /* dom */,
8107
8113
  getOrCreateSection(placeholder),
@@ -8123,7 +8129,7 @@ var placeholder_default = {
8123
8129
  const isHTML = isOutputHTML();
8124
8130
  const write2 = writeTo(placeholder);
8125
8131
  const extra = node.extra || {};
8126
- const nodeBinding = extra[kBinding2];
8132
+ const nodeBinding = extra[kBinding];
8127
8133
  const canWriteHTML = isHTML || confident && node.escape;
8128
8134
  const method = canWriteHTML ? node.escape ? "escapeXML" : "toString" : node.escape ? "data" : "html";
8129
8135
  const isStateful = isStatefulReferences(referencedBindings);
@@ -8152,10 +8158,10 @@ var placeholder_default = {
8152
8158
  "render",
8153
8159
  getSection(placeholder),
8154
8160
  value.extra?.referencedBindings,
8155
- import_compiler48.types.expressionStatement(
8161
+ import_compiler49.types.expressionStatement(
8156
8162
  method === "data" ? callRuntime(
8157
8163
  "data",
8158
- import_compiler48.types.memberExpression(
8164
+ import_compiler49.types.memberExpression(
8159
8165
  scopeIdentifier,
8160
8166
  getScopeAccessorLiteral(nodeBinding),
8161
8167
  true
@@ -8192,7 +8198,7 @@ function analyzeSiblingText(placeholder) {
8192
8198
  break;
8193
8199
  }
8194
8200
  }
8195
- if (!prev.node && import_compiler48.types.isProgram(placeholder.parentPath)) {
8201
+ if (!prev.node && import_compiler49.types.isProgram(placeholder.parentPath)) {
8196
8202
  return placeholderExtra[kSiblingText] = 1 /* Before */;
8197
8203
  }
8198
8204
  let next = placeholder.getNextSibling();
@@ -8209,7 +8215,7 @@ function analyzeSiblingText(placeholder) {
8209
8215
  break;
8210
8216
  }
8211
8217
  }
8212
- if (!next.node && import_compiler48.types.isProgram(placeholder.parentPath)) {
8218
+ if (!next.node && import_compiler49.types.isProgram(placeholder.parentPath)) {
8213
8219
  return placeholderExtra[kSiblingText] = 2 /* After */;
8214
8220
  }
8215
8221
  return placeholderExtra[kSiblingText] = 0 /* None */;
@@ -8219,7 +8225,7 @@ function isVoid2(value) {
8219
8225
  }
8220
8226
 
8221
8227
  // src/translator/visitors/referenced-identifier.ts
8222
- var import_compiler49 = require("@marko/compiler");
8228
+ var import_compiler50 = require("@marko/compiler");
8223
8229
  var abortIdsByExpressionForSection = /* @__PURE__ */ new WeakMap();
8224
8230
  var referenced_identifier_default = {
8225
8231
  migrate(identifier) {
@@ -8227,8 +8233,8 @@ var referenced_identifier_default = {
8227
8233
  if (identifier.scope.hasBinding(name2)) return;
8228
8234
  switch (name2) {
8229
8235
  case "out":
8230
- if (import_compiler49.types.isMemberExpression(identifier.parent) && import_compiler49.types.isIdentifier(identifier.parent.property) && identifier.parent.property.name === "global") {
8231
- identifier.parentPath.replaceWith(import_compiler49.types.identifier("$global"));
8236
+ if (import_compiler50.types.isMemberExpression(identifier.parent) && import_compiler50.types.isIdentifier(identifier.parent.property) && identifier.parent.property.name === "global") {
8237
+ identifier.parentPath.replaceWith(import_compiler50.types.identifier("$global"));
8232
8238
  } else {
8233
8239
  throw identifier.buildCodeFrameError(
8234
8240
  "Only `out.global` is supported for compatibility."
@@ -8255,24 +8261,24 @@ var referenced_identifier_default = {
8255
8261
  case "$global":
8256
8262
  if (isOutputHTML()) {
8257
8263
  identifier.replaceWith(
8258
- import_compiler49.types.callExpression(importRuntime("$global"), [])
8264
+ import_compiler50.types.callExpression(importRuntime("$global"), [])
8259
8265
  );
8260
8266
  } else {
8261
8267
  identifier.replaceWith(
8262
- import_compiler49.types.memberExpression(scopeIdentifier, import_compiler49.types.identifier("$global"))
8268
+ import_compiler50.types.memberExpression(scopeIdentifier, import_compiler50.types.identifier("$global"))
8263
8269
  );
8264
8270
  }
8265
8271
  break;
8266
8272
  case "$signal":
8267
8273
  if (isOutputHTML()) {
8268
8274
  identifier.replaceWith(
8269
- import_compiler49.types.callExpression(
8270
- import_compiler49.types.arrowFunctionExpression(
8275
+ import_compiler50.types.callExpression(
8276
+ import_compiler50.types.arrowFunctionExpression(
8271
8277
  [],
8272
- import_compiler49.types.blockStatement([
8273
- import_compiler49.types.throwStatement(
8274
- import_compiler49.types.newExpression(import_compiler49.types.identifier("Error"), [
8275
- import_compiler49.types.stringLiteral("Cannot use $signal in a server render.")
8278
+ import_compiler50.types.blockStatement([
8279
+ import_compiler50.types.throwStatement(
8280
+ import_compiler50.types.newExpression(import_compiler50.types.identifier("Error"), [
8281
+ import_compiler50.types.stringLiteral("Cannot use $signal in a server render.")
8276
8282
  ])
8277
8283
  )
8278
8284
  ])
@@ -8298,18 +8304,18 @@ var referenced_identifier_default = {
8298
8304
  "render",
8299
8305
  section,
8300
8306
  exprRoot.node.extra?.referencedBindings,
8301
- import_compiler49.types.expressionStatement(
8302
- import_compiler49.types.callExpression(importRuntime("resetAbortSignal"), [
8307
+ import_compiler50.types.expressionStatement(
8308
+ import_compiler50.types.callExpression(importRuntime("resetAbortSignal"), [
8303
8309
  scopeIdentifier,
8304
- import_compiler49.types.numericLiteral(exprId)
8310
+ import_compiler50.types.numericLiteral(exprId)
8305
8311
  ])
8306
8312
  )
8307
8313
  );
8308
8314
  }
8309
8315
  identifier.replaceWith(
8310
- import_compiler49.types.callExpression(importRuntime("getAbortSignal"), [
8316
+ import_compiler50.types.callExpression(importRuntime("getAbortSignal"), [
8311
8317
  scopeIdentifier,
8312
- import_compiler49.types.numericLiteral(exprId)
8318
+ import_compiler50.types.numericLiteral(exprId)
8313
8319
  ])
8314
8320
  );
8315
8321
  }
@@ -8349,21 +8355,21 @@ var scriptlet_default = {
8349
8355
  };
8350
8356
 
8351
8357
  // src/translator/visitors/tag/index.ts
8352
- var import_compiler53 = require("@marko/compiler");
8353
- var import_babel_utils42 = require("@marko/compiler/babel-utils");
8358
+ var import_compiler54 = require("@marko/compiler");
8359
+ var import_babel_utils43 = require("@marko/compiler/babel-utils");
8354
8360
 
8355
8361
  // src/translator/visitors/tag/attribute-tag.ts
8356
- var import_compiler50 = require("@marko/compiler");
8357
- var import_babel_utils39 = require("@marko/compiler/babel-utils");
8362
+ var import_compiler51 = require("@marko/compiler");
8363
+ var import_babel_utils40 = require("@marko/compiler/babel-utils");
8358
8364
  var attribute_tag_default = {
8359
8365
  analyze: {
8360
8366
  enter(tag) {
8361
- (0, import_babel_utils39.assertNoVar)(tag);
8362
- (0, import_babel_utils39.assertNoArgs)(tag);
8367
+ (0, import_babel_utils40.assertNoVar)(tag);
8368
+ (0, import_babel_utils40.assertNoArgs)(tag);
8363
8369
  const body = tag.get("body");
8364
8370
  startSection(body);
8365
8371
  trackParamsReferences(body, 3 /* param */);
8366
- if (!(0, import_babel_utils39.findParentTag)(tag)) {
8372
+ if (!(0, import_babel_utils40.findParentTag)(tag)) {
8367
8373
  throw tag.get("name").buildCodeFrameError("@tags must be nested within another tag.");
8368
8374
  }
8369
8375
  }
@@ -8384,17 +8390,17 @@ var attribute_tag_default = {
8384
8390
  };
8385
8391
 
8386
8392
  // src/translator/visitors/tag/custom-tag.ts
8387
- var import_compiler51 = require("@marko/compiler");
8388
- var import_babel_utils40 = require("@marko/compiler/babel-utils");
8393
+ var import_compiler52 = require("@marko/compiler");
8394
+ var import_babel_utils41 = require("@marko/compiler/babel-utils");
8389
8395
  var import_path4 = __toESM(require("path"));
8390
8396
  var kChildScopeBinding = Symbol("custom tag child scope");
8391
8397
  var kChildAttrExprs = Symbol("custom tag child attribute expressions");
8392
8398
  var custom_tag_default = {
8393
8399
  analyze: {
8394
8400
  enter(tag) {
8395
- (0, import_babel_utils40.assertAttributesOrSingleArg)(tag);
8401
+ (0, import_babel_utils41.assertAttributesOrSingleArg)(tag);
8396
8402
  analyzeAttributeTags(tag);
8397
- const templateFile = (0, import_babel_utils40.getTagTemplate)(tag);
8403
+ const templateFile = (0, import_babel_utils41.getTagTemplate)(tag);
8398
8404
  if (!templateFile) {
8399
8405
  const tagName = getTagName(tag);
8400
8406
  if (tagName && tag.scope.hasBinding(tagName)) {
@@ -8418,7 +8424,7 @@ var custom_tag_default = {
8418
8424
  tagExtra
8419
8425
  );
8420
8426
  tagExtra[kChildAttrExprs] = /* @__PURE__ */ new Set([tagExtra]);
8421
- const childFile = (0, import_babel_utils40.loadFileForTag)(tag);
8427
+ const childFile = (0, import_babel_utils41.loadFileForTag)(tag);
8422
8428
  if (childFile.opts.filename === tag.hub.file.opts.filename) {
8423
8429
  mergeReferences(section, tag.node, getAllTagReferenceNodes(tag.node));
8424
8430
  } else {
@@ -8455,15 +8461,15 @@ function translateHTML(tag) {
8455
8461
  let tagIdentifier;
8456
8462
  flushInto(tag);
8457
8463
  writeHTMLResumeStatements(tagBody);
8458
- if (import_compiler51.types.isStringLiteral(node.name)) {
8464
+ if (import_compiler52.types.isStringLiteral(node.name)) {
8459
8465
  const relativePath = getTagRelativePath(tag);
8460
- tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? htmlRendererIdentifier : (0, import_babel_utils40.importDefault)(tag.hub.file, relativePath, getTagName(tag));
8466
+ tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? htmlRendererIdentifier : (0, import_babel_utils41.importDefault)(tag.hub.file, relativePath, getTagName(tag));
8461
8467
  } else {
8462
8468
  tagIdentifier = node.name;
8463
8469
  }
8464
8470
  const tagVar = node.var;
8465
8471
  const section = getSection(tag);
8466
- const inputExport = (0, import_babel_utils40.loadFileForTag)(tag)?.ast.program.extra?.domExports?.params?.props?.[0];
8472
+ const inputExport = (0, import_babel_utils41.loadFileForTag)(tag)?.ast.program.extra?.domExports?.params?.props?.[0];
8467
8473
  const { properties, statements } = inputExport ? translateAttrs(tag, inputExport.props) : {
8468
8474
  properties: [],
8469
8475
  statements: []
@@ -8481,8 +8487,8 @@ function translateHTML(tag) {
8481
8487
  childScopeBinding?.name
8482
8488
  );
8483
8489
  tag.insertBefore(
8484
- import_compiler51.types.variableDeclaration("const", [
8485
- import_compiler51.types.variableDeclarator(peekScopeId, callRuntime("peekNextScope"))
8490
+ import_compiler52.types.variableDeclaration("const", [
8491
+ import_compiler52.types.variableDeclarator(peekScopeId, callRuntime("peekNextScope"))
8486
8492
  ])
8487
8493
  );
8488
8494
  getSerializedScopeProperties(section).set(
@@ -8491,12 +8497,12 @@ function translateHTML(tag) {
8491
8497
  );
8492
8498
  if (tagVar) {
8493
8499
  statements.push(
8494
- import_compiler51.types.expressionStatement(
8500
+ import_compiler52.types.expressionStatement(
8495
8501
  callRuntime(
8496
8502
  "setTagVar",
8497
8503
  getScopeIdIdentifier(section),
8498
8504
  peekScopeId,
8499
- import_compiler51.types.stringLiteral(
8505
+ import_compiler52.types.stringLiteral(
8500
8506
  getResumeRegisterId(
8501
8507
  section,
8502
8508
  node.var.extra?.binding,
@@ -8516,8 +8522,8 @@ function translateHTML(tag) {
8516
8522
  const contentExpression = contentProp.value;
8517
8523
  contentProp.value = contentId = tag.scope.generateUidIdentifier("content");
8518
8524
  const [contentPath] = tag.insertBefore(
8519
- import_compiler51.types.variableDeclaration("const", [
8520
- import_compiler51.types.variableDeclarator(
8525
+ import_compiler52.types.variableDeclaration("const", [
8526
+ import_compiler52.types.variableDeclarator(
8521
8527
  contentId,
8522
8528
  // TODO: only register if needed (child template analysis)
8523
8529
  contentExpression
@@ -8531,13 +8537,13 @@ function translateHTML(tag) {
8531
8537
  propsToExpression(properties)
8532
8538
  );
8533
8539
  if (tagVar) {
8534
- translateVar(tag, import_compiler51.types.unaryExpression("void", import_compiler51.types.numericLiteral(0)), "let");
8535
- renderTagExpr = import_compiler51.types.assignmentExpression("=", tagVar, renderTagExpr);
8540
+ translateVar(tag, import_compiler52.types.unaryExpression("void", import_compiler52.types.numericLiteral(0)), "let");
8541
+ renderTagExpr = import_compiler52.types.assignmentExpression("=", tagVar, renderTagExpr);
8536
8542
  }
8537
8543
  statements.push(
8538
- import_compiler51.types.ifStatement(
8544
+ import_compiler52.types.ifStatement(
8539
8545
  tagIdentifier,
8540
- import_compiler51.types.expressionStatement(renderTagExpr),
8546
+ import_compiler52.types.expressionStatement(renderTagExpr),
8541
8547
  contentId && callStatement(contentId)
8542
8548
  )
8543
8549
  );
@@ -8563,9 +8569,9 @@ function translateDOM(tag) {
8563
8569
  const childScopeBinding = extra[kChildScopeBinding];
8564
8570
  const write2 = writeTo(tag);
8565
8571
  const { file } = tag.hub;
8566
- const tagName = import_compiler51.types.isIdentifier(node.name) ? node.name.name : import_compiler51.types.isStringLiteral(node.name) ? node.name.value : "tag";
8572
+ const tagName = import_compiler52.types.isIdentifier(node.name) ? node.name.name : import_compiler52.types.isStringLiteral(node.name) ? node.name.value : "tag";
8567
8573
  const relativePath = getTagRelativePath(tag);
8568
- const childFile = (0, import_babel_utils40.loadFileForTag)(tag);
8574
+ const childFile = (0, import_babel_utils41.loadFileForTag)(tag);
8569
8575
  const childExports = childFile.ast.program.extra.domExports;
8570
8576
  const tagIdentifier = importOrSelfReferenceName(
8571
8577
  file,
@@ -8583,10 +8589,10 @@ function translateDOM(tag) {
8583
8589
  attrTagCallsByTag: void 0
8584
8590
  });
8585
8591
  }
8586
- write2`${(0, import_babel_utils40.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
8592
+ write2`${(0, import_babel_utils41.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
8587
8593
  injectWalks(
8588
8594
  tag,
8589
- (0, import_babel_utils40.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
8595
+ (0, import_babel_utils41.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
8590
8596
  );
8591
8597
  if (node.var) {
8592
8598
  const source = initValue(
@@ -8595,7 +8601,7 @@ function translateDOM(tag) {
8595
8601
  );
8596
8602
  source.register = true;
8597
8603
  source.buildAssignment = (valueSection, value) => {
8598
- return import_compiler51.types.callExpression(importRuntime("tagVarSignalChange"), [
8604
+ return import_compiler52.types.callExpression(importRuntime("tagVarSignalChange"), [
8599
8605
  createScopeReadExpression(valueSection, childScopeBinding),
8600
8606
  value
8601
8607
  ]);
@@ -8604,7 +8610,7 @@ function translateDOM(tag) {
8604
8610
  "render",
8605
8611
  tagSection,
8606
8612
  void 0,
8607
- import_compiler51.types.expressionStatement(
8613
+ import_compiler52.types.expressionStatement(
8608
8614
  callRuntime(
8609
8615
  "setTagVar",
8610
8616
  scopeIdentifier,
@@ -8618,8 +8624,8 @@ function translateDOM(tag) {
8618
8624
  "render",
8619
8625
  tagSection,
8620
8626
  void 0,
8621
- import_compiler51.types.expressionStatement(
8622
- import_compiler51.types.callExpression(tagIdentifier, [
8627
+ import_compiler52.types.expressionStatement(
8628
+ import_compiler52.types.callExpression(tagIdentifier, [
8623
8629
  createScopeReadExpression(tagSection, childScopeBinding)
8624
8630
  ])
8625
8631
  )
@@ -8632,9 +8638,9 @@ function getTagRelativePath(tag) {
8632
8638
  hub: { file }
8633
8639
  } = tag;
8634
8640
  let relativePath;
8635
- if (import_compiler51.types.isStringLiteral(node.name)) {
8636
- const template = (0, import_babel_utils40.getTagTemplate)(tag);
8637
- relativePath = template && (0, import_babel_utils40.resolveRelativePath)(file, template);
8641
+ if (import_compiler52.types.isStringLiteral(node.name)) {
8642
+ const template = (0, import_babel_utils41.getTagTemplate)(tag);
8643
+ relativePath = template && (0, import_babel_utils41.resolveRelativePath)(file, template);
8638
8644
  } else if (node.extra?.tagNameImported) {
8639
8645
  relativePath = node.extra.tagNameImported;
8640
8646
  }
@@ -8680,7 +8686,7 @@ function analyzeAttrs(rootTagExtra, section, tag, templateExport) {
8680
8686
  const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
8681
8687
  for (const child of attrTags2) {
8682
8688
  if (child.isMarkoTag()) {
8683
- if ((0, import_babel_utils40.isAttributeTag)(child)) {
8689
+ if ((0, import_babel_utils41.isAttributeTag)(child)) {
8684
8690
  const attrTagMeta = attrTagLookup[getTagName(child)];
8685
8691
  const childAttrExports = templateExport.props[attrTagMeta.name];
8686
8692
  if (childAttrExports) {
@@ -8721,7 +8727,7 @@ function analyzeAttrs(rootTagExtra, section, tag, templateExport) {
8721
8727
  let spreadReferenceNodes;
8722
8728
  for (let i = attributes.length; i--; ) {
8723
8729
  const attr2 = attributes[i];
8724
- if (import_compiler51.types.isMarkoAttribute(attr2)) {
8730
+ if (import_compiler52.types.isMarkoAttribute(attr2)) {
8725
8731
  if (seen.has(attr2.name) || !templateExport.props[attr2.name]) {
8726
8732
  dropReferences(attr2.value);
8727
8733
  continue;
@@ -8730,7 +8736,7 @@ function analyzeAttrs(rootTagExtra, section, tag, templateExport) {
8730
8736
  }
8731
8737
  if (spreadReferenceNodes) {
8732
8738
  spreadReferenceNodes.push(attr2.value);
8733
- } else if (import_compiler51.types.isMarkoSpreadAttribute(attr2)) {
8739
+ } else if (import_compiler52.types.isMarkoSpreadAttribute(attr2)) {
8734
8740
  spreadReferenceNodes = [attr2.value];
8735
8741
  } else {
8736
8742
  rootTagExtra[kChildAttrExprs].add(attr2.value.extra ??= {});
@@ -8755,12 +8761,12 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8755
8761
  // but we should probably ensure all other references are dropped in this case before we do that.
8756
8762
  tag.node.extra?.referencedBindings,
8757
8763
  identifierToSignal(tagInputIdentifier),
8758
- import_compiler51.types.isSpreadElement(arg) ? import_compiler51.types.memberExpression(arg.argument, import_compiler51.types.numericLiteral(0), true) : arg,
8764
+ import_compiler52.types.isSpreadElement(arg) ? import_compiler52.types.memberExpression(arg.argument, import_compiler52.types.numericLiteral(0), true) : arg,
8759
8765
  createScopeReadExpression(info.tagSection, info.childScopeBinding),
8760
8766
  callRuntime(
8761
8767
  "inChild",
8762
8768
  getScopeAccessorLiteral(info.childScopeBinding),
8763
- import_compiler51.types.identifier(tagInputIdentifier.name)
8769
+ import_compiler52.types.identifier(tagInputIdentifier.name)
8764
8770
  )
8765
8771
  );
8766
8772
  return;
@@ -8783,7 +8789,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8783
8789
  );
8784
8790
  }
8785
8791
  let translatedProps = propsToExpression(translatedAttrs.properties);
8786
- if ((0, import_babel_utils40.isAttributeTag)(tag)) {
8792
+ if ((0, import_babel_utils41.isAttributeTag)(tag)) {
8787
8793
  const attrTagName = getTagName(tag);
8788
8794
  const parentTag = tag.parentPath;
8789
8795
  const repeated = analyzeAttributeTags(parentTag)?.[attrTagName]?.repeated;
@@ -8808,7 +8814,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8808
8814
  } else {
8809
8815
  attrTagCallsForTag.set(
8810
8816
  attrTagName,
8811
- translatedProps = import_compiler51.types.parenthesizedExpression(
8817
+ translatedProps = import_compiler52.types.parenthesizedExpression(
8812
8818
  callRuntime("attrTag", translatedProps)
8813
8819
  )
8814
8820
  );
@@ -8826,7 +8832,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8826
8832
  callRuntime(
8827
8833
  "inChild",
8828
8834
  getScopeAccessorLiteral(info.childScopeBinding),
8829
- import_compiler51.types.identifier(tagInputIdentifier.name)
8835
+ import_compiler52.types.identifier(tagInputIdentifier.name)
8830
8836
  )
8831
8837
  );
8832
8838
  return;
@@ -8860,7 +8866,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8860
8866
  for (let i = 0; i < attrTags2.length; i++) {
8861
8867
  const child = attrTags2[i];
8862
8868
  if (child.isMarkoTag()) {
8863
- if ((0, import_babel_utils40.isAttributeTag)(child)) {
8869
+ if ((0, import_babel_utils41.isAttributeTag)(child)) {
8864
8870
  const attrTagMeta = attrTagLookup[getTagName(child)];
8865
8871
  const childAttrExport = templateExport.props[attrTagMeta.name];
8866
8872
  if (childAttrExport) {
@@ -8898,7 +8904,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8898
8904
  childAttrExports.id,
8899
8905
  `${importAlias}_${attrTagMeta.name}`
8900
8906
  );
8901
- decls.push(import_compiler51.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta)));
8907
+ decls.push(import_compiler52.types.variableDeclarator(getAttrTagIdentifier(attrTagMeta)));
8902
8908
  addValue(
8903
8909
  info.tagSection,
8904
8910
  referencedBindings,
@@ -8908,12 +8914,12 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8908
8914
  callRuntime(
8909
8915
  "inChild",
8910
8916
  getScopeAccessorLiteral(info.childScopeBinding),
8911
- import_compiler51.types.identifier(attrExportIdentifier.name)
8917
+ import_compiler52.types.identifier(attrExportIdentifier.name)
8912
8918
  )
8913
8919
  );
8914
8920
  }
8915
8921
  addStatement("render", info.tagSection, referencedBindings, [
8916
- import_compiler51.types.variableDeclaration("let", decls),
8922
+ import_compiler52.types.variableDeclaration("let", decls),
8917
8923
  ...statements
8918
8924
  ]);
8919
8925
  }
@@ -8922,7 +8928,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8922
8928
  if (bodySection && !seen.has("content")) {
8923
8929
  seen.add("content");
8924
8930
  if (templateExport.props.content) {
8925
- const contentExportIdentifier = (0, import_babel_utils40.importNamed)(
8931
+ const contentExportIdentifier = (0, import_babel_utils41.importNamed)(
8926
8932
  tag.hub.file,
8927
8933
  info.relativePath,
8928
8934
  templateExport.props.content.id,
@@ -8933,12 +8939,12 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8933
8939
  void 0,
8934
8940
  // TODO: pretty sure content needs to have the reference group of it's param defaults.
8935
8941
  identifierToSignal(contentExportIdentifier),
8936
- import_compiler51.types.callExpression(import_compiler51.types.identifier(bodySection.name), [scopeIdentifier]),
8942
+ import_compiler52.types.callExpression(import_compiler52.types.identifier(bodySection.name), [scopeIdentifier]),
8937
8943
  createScopeReadExpression(info.tagSection, info.childScopeBinding),
8938
8944
  callRuntime(
8939
8945
  "inChild",
8940
8946
  getScopeAccessorLiteral(info.childScopeBinding),
8941
- import_compiler51.types.identifier(contentExportIdentifier.name)
8947
+ import_compiler52.types.identifier(contentExportIdentifier.name)
8942
8948
  )
8943
8949
  );
8944
8950
  }
@@ -8948,7 +8954,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8948
8954
  let spreadProps;
8949
8955
  for (let i = attributes.length; i--; ) {
8950
8956
  const attr2 = attributes[i];
8951
- if (import_compiler51.types.isMarkoAttribute(attr2)) {
8957
+ if (import_compiler52.types.isMarkoAttribute(attr2)) {
8952
8958
  const childAttrExports = templateExport.props[attr2.name];
8953
8959
  if (!childAttrExports || seen.has(attr2.name)) continue;
8954
8960
  seen.add(attr2.name);
@@ -8958,9 +8964,9 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8958
8964
  }
8959
8965
  staticAttrs.push(attr2);
8960
8966
  } else if (spreadProps) {
8961
- spreadProps.push(import_compiler51.types.spreadElement(attr2.value));
8967
+ spreadProps.push(import_compiler52.types.spreadElement(attr2.value));
8962
8968
  } else {
8963
- spreadProps = [import_compiler51.types.spreadElement(attr2.value)];
8969
+ spreadProps = [import_compiler52.types.spreadElement(attr2.value)];
8964
8970
  }
8965
8971
  }
8966
8972
  for (const attr2 of staticAttrs.reverse()) {
@@ -8980,7 +8986,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8980
8986
  callRuntime(
8981
8987
  "inChild",
8982
8988
  getScopeAccessorLiteral(info.childScopeBinding),
8983
- import_compiler51.types.identifier(attrExportIdentifier.name)
8989
+ import_compiler52.types.identifier(attrExportIdentifier.name)
8984
8990
  )
8985
8991
  );
8986
8992
  }
@@ -8994,8 +9000,8 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
8994
9000
  spreadProps.reverse();
8995
9001
  getMissingPropValue = (name2) => toMemberExpression(spreadId, name2);
8996
9002
  addStatement("render", info.tagSection, referencedBindings, [
8997
- import_compiler51.types.variableDeclaration("const", [
8998
- import_compiler51.types.variableDeclarator(spreadId, propsToExpression(spreadProps))
9003
+ import_compiler52.types.variableDeclaration("const", [
9004
+ import_compiler52.types.variableDeclarator(spreadId, propsToExpression(spreadProps))
8999
9005
  ])
9000
9006
  ]);
9001
9007
  }
@@ -9016,7 +9022,7 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
9016
9022
  callRuntime(
9017
9023
  "inChild",
9018
9024
  getScopeAccessorLiteral(info.childScopeBinding),
9019
- import_compiler51.types.identifier(attrExportIdentifier.name)
9025
+ import_compiler52.types.identifier(attrExportIdentifier.name)
9020
9026
  )
9021
9027
  );
9022
9028
  }
@@ -9024,19 +9030,19 @@ function writeAttrsToExports(tag, templateExport, importAlias, info) {
9024
9030
  }
9025
9031
  function importOrSelfReferenceName(file, request, name2, nameHint) {
9026
9032
  if (isCircularRequest(file, request)) {
9027
- return import_compiler51.types.identifier(name2);
9033
+ return import_compiler52.types.identifier(name2);
9028
9034
  }
9029
- return (0, import_babel_utils40.importNamed)(file, request, name2, nameHint);
9035
+ return (0, import_babel_utils41.importNamed)(file, request, name2, nameHint);
9030
9036
  }
9031
9037
  function isCircularRequest(file, request) {
9032
9038
  const { filename } = file.opts;
9033
9039
  return request === filename || request[0] === "." && import_path4.default.resolve(filename, "..", request) === filename;
9034
9040
  }
9035
9041
  function callStatement(id, ...args) {
9036
- return import_compiler51.types.expressionStatement(callExpression(id, ...args));
9042
+ return import_compiler52.types.expressionStatement(callExpression(id, ...args));
9037
9043
  }
9038
9044
  function callExpression(id, ...args) {
9039
- return import_compiler51.types.callExpression(id, args.filter(Boolean));
9045
+ return import_compiler52.types.callExpression(id, args.filter(Boolean));
9040
9046
  }
9041
9047
  function identifierToSignal(identifier) {
9042
9048
  return {
@@ -9045,20 +9051,20 @@ function identifierToSignal(identifier) {
9045
9051
  };
9046
9052
  }
9047
9053
  function buildUndefined2() {
9048
- return import_compiler51.types.unaryExpression("void", import_compiler51.types.numericLiteral(0));
9054
+ return import_compiler52.types.unaryExpression("void", import_compiler52.types.numericLiteral(0));
9049
9055
  }
9050
9056
  function always() {
9051
9057
  return true;
9052
9058
  }
9053
9059
 
9054
9060
  // src/translator/visitors/tag/dynamic-tag.ts
9055
- var import_compiler52 = require("@marko/compiler");
9056
- var import_babel_utils41 = require("@marko/compiler/babel-utils");
9061
+ var import_compiler53 = require("@marko/compiler");
9062
+ var import_babel_utils42 = require("@marko/compiler/babel-utils");
9057
9063
  var kDOMBinding = Symbol("dynamic tag dom binding");
9058
9064
  var dynamic_tag_default = {
9059
9065
  analyze: {
9060
9066
  enter(tag) {
9061
- (0, import_babel_utils41.assertAttributesOrArgs)(tag);
9067
+ (0, import_babel_utils42.assertAttributesOrArgs)(tag);
9062
9068
  analyzeAttributeTags(tag);
9063
9069
  const section = getOrCreateSection(tag);
9064
9070
  const tagExtra = tag.node.extra ??= {};
@@ -9092,8 +9098,8 @@ var dynamic_tag_default = {
9092
9098
  const section = getSection(tag);
9093
9099
  const isClassAPI = extra.featureType === "class";
9094
9100
  let tagExpression = node.name;
9095
- if (import_compiler52.types.isStringLiteral(tagExpression)) {
9096
- tagExpression = (0, import_babel_utils41.importDefault)(
9101
+ if (import_compiler53.types.isStringLiteral(tagExpression)) {
9102
+ tagExpression = (0, import_babel_utils42.importDefault)(
9097
9103
  tag.hub.file,
9098
9104
  getTagRelativePath(tag),
9099
9105
  tagExpression.value
@@ -9103,12 +9109,12 @@ var dynamic_tag_default = {
9103
9109
  if (isOutputHTML()) {
9104
9110
  currentProgramPath.pushContainer(
9105
9111
  "body",
9106
- import_compiler52.types.expressionStatement(
9107
- import_compiler52.types.callExpression(
9108
- (0, import_babel_utils41.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
9112
+ import_compiler53.types.expressionStatement(
9113
+ import_compiler53.types.callExpression(
9114
+ (0, import_babel_utils42.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
9109
9115
  [
9110
- import_compiler52.types.identifier(tagExpression.name),
9111
- import_compiler52.types.stringLiteral((0, import_babel_utils41.loadFileForTag)(tag).metadata.marko.id)
9116
+ import_compiler53.types.identifier(tagExpression.name),
9117
+ import_compiler53.types.stringLiteral((0, import_babel_utils42.loadFileForTag)(tag).metadata.marko.id)
9112
9118
  ]
9113
9119
  )
9114
9120
  )
@@ -9116,11 +9122,11 @@ var dynamic_tag_default = {
9116
9122
  } else {
9117
9123
  currentProgramPath.pushContainer(
9118
9124
  "body",
9119
- import_compiler52.types.expressionStatement(
9125
+ import_compiler53.types.expressionStatement(
9120
9126
  callRuntime(
9121
9127
  "register",
9122
- import_compiler52.types.stringLiteral((0, import_babel_utils41.loadFileForTag)(tag).metadata.marko.id),
9123
- import_compiler52.types.identifier(tagExpression.name)
9128
+ import_compiler53.types.stringLiteral((0, import_babel_utils42.loadFileForTag)(tag).metadata.marko.id),
9129
+ import_compiler53.types.identifier(tagExpression.name)
9124
9130
  )
9125
9131
  )
9126
9132
  );
@@ -9140,7 +9146,7 @@ var dynamic_tag_default = {
9140
9146
  hasMultipleArgs = true;
9141
9147
  args.push(propsToExpression(properties));
9142
9148
  } else {
9143
- hasMultipleArgs = node.arguments.length > 1 || import_compiler52.types.isSpreadElement(node.arguments[0]);
9149
+ hasMultipleArgs = node.arguments.length > 1 || import_compiler53.types.isSpreadElement(node.arguments[0]);
9144
9150
  }
9145
9151
  } else {
9146
9152
  const contentProp = getTranslatedBodyContentProperty(properties);
@@ -9156,7 +9162,7 @@ var dynamic_tag_default = {
9156
9162
  writeHTMLResumeStatements(tag.get("body"));
9157
9163
  if (node.var) {
9158
9164
  if (!hasMultipleArgs && args.length === 1) {
9159
- args.push(import_compiler52.types.unaryExpression("void", import_compiler52.types.numericLiteral(0)));
9165
+ args.push(import_compiler53.types.unaryExpression("void", import_compiler53.types.numericLiteral(0)));
9160
9166
  }
9161
9167
  }
9162
9168
  const dynamicScopeIdentifier = currentProgramPath.scope.generateUidIdentifier("dynamicScope");
@@ -9165,7 +9171,7 @@ var dynamic_tag_default = {
9165
9171
  getScopeIdIdentifier(section),
9166
9172
  getScopeAccessorLiteral(nodeRef2),
9167
9173
  tagExpression,
9168
- import_compiler52.types.arrayExpression(args)
9174
+ import_compiler53.types.arrayExpression(args)
9169
9175
  ) : callRuntime(
9170
9176
  "dynamicTagInput",
9171
9177
  getScopeIdIdentifier(section),
@@ -9174,8 +9180,8 @@ var dynamic_tag_default = {
9174
9180
  ...args
9175
9181
  );
9176
9182
  statements.push(
9177
- import_compiler52.types.variableDeclaration("const", [
9178
- import_compiler52.types.variableDeclarator(
9183
+ import_compiler53.types.variableDeclaration("const", [
9184
+ import_compiler53.types.variableDeclarator(
9179
9185
  dynamicScopeIdentifier,
9180
9186
  callRuntime("peekNextScope")
9181
9187
  )
@@ -9183,12 +9189,12 @@ var dynamic_tag_default = {
9183
9189
  );
9184
9190
  if (node.var) {
9185
9191
  statements.push(
9186
- import_compiler52.types.expressionStatement(
9192
+ import_compiler53.types.expressionStatement(
9187
9193
  callRuntime(
9188
9194
  "setTagVar",
9189
9195
  getScopeIdIdentifier(section),
9190
9196
  dynamicScopeIdentifier,
9191
- import_compiler52.types.stringLiteral(
9197
+ import_compiler53.types.stringLiteral(
9192
9198
  getResumeRegisterId(
9193
9199
  section,
9194
9200
  node.var.extra?.binding,
@@ -9198,26 +9204,26 @@ var dynamic_tag_default = {
9198
9204
  )
9199
9205
  )
9200
9206
  ),
9201
- import_compiler52.types.variableDeclaration("const", [
9202
- import_compiler52.types.variableDeclarator(node.var, dynamicTagExpr)
9207
+ import_compiler53.types.variableDeclaration("const", [
9208
+ import_compiler53.types.variableDeclarator(node.var, dynamicTagExpr)
9203
9209
  ])
9204
9210
  );
9205
9211
  } else {
9206
- statements.push(import_compiler52.types.expressionStatement(dynamicTagExpr));
9212
+ statements.push(import_compiler53.types.expressionStatement(dynamicTagExpr));
9207
9213
  }
9208
9214
  getSerializedScopeProperties(section).set(
9209
- import_compiler52.types.stringLiteral(
9215
+ import_compiler53.types.stringLiteral(
9210
9216
  getScopeAccessorLiteral(nodeRef2).value + "!" /* ConditionalScope */
9211
9217
  ),
9212
9218
  callRuntime("writeExistingScope", dynamicScopeIdentifier)
9213
9219
  );
9214
9220
  getSerializedScopeProperties(section).set(
9215
- import_compiler52.types.stringLiteral(
9221
+ import_compiler53.types.stringLiteral(
9216
9222
  getScopeAccessorLiteral(nodeRef2).value + "(" /* ConditionalRenderer */
9217
9223
  ),
9218
9224
  callRuntime(
9219
9225
  "normalizeDynamicRenderer",
9220
- import_compiler52.types.isIdentifier(tagExpression) ? import_compiler52.types.identifier(tagExpression.name) : tagExpression
9226
+ import_compiler53.types.isIdentifier(tagExpression) ? import_compiler53.types.identifier(tagExpression.name) : tagExpression
9221
9227
  )
9222
9228
  );
9223
9229
  for (const replacement of tag.replaceWithMultiple(statements)) {
@@ -9226,10 +9232,10 @@ var dynamic_tag_default = {
9226
9232
  } else {
9227
9233
  const section2 = getSection(tag);
9228
9234
  const bodySection = getSectionForBody(tag.get("body"));
9229
- const signal = getSignal(section2, nodeRef2, "dynamicTagName");
9235
+ const signal = getSignal(section2, nodeRef2, "dynamicTag");
9230
9236
  signal.build = () => {
9231
9237
  return callRuntime(
9232
- "conditional",
9238
+ "dynamicTag",
9233
9239
  getScopeAccessorLiteral(nodeRef2),
9234
9240
  getSignalFn(signal, [scopeIdentifier]),
9235
9241
  buildSignalIntersections(signal)
@@ -9240,16 +9246,16 @@ var dynamic_tag_default = {
9240
9246
  section2,
9241
9247
  node.name.extra?.referencedBindings,
9242
9248
  signal,
9243
- bodySection ? import_compiler52.types.logicalExpression(
9249
+ bodySection ? import_compiler53.types.logicalExpression(
9244
9250
  "||",
9245
9251
  tagExpression,
9246
- import_compiler52.types.callExpression(import_compiler52.types.identifier(bodySection.name), [
9252
+ import_compiler53.types.callExpression(import_compiler53.types.identifier(bodySection.name), [
9247
9253
  scopeIdentifier
9248
9254
  ])
9249
9255
  ) : tagExpression
9250
9256
  );
9251
9257
  if (tag.node.var) {
9252
- const childScopeLiteral = import_compiler52.types.stringLiteral(
9258
+ const childScopeLiteral = import_compiler53.types.stringLiteral(
9253
9259
  getScopeAccessorLiteral(extra[kDOMBinding]).value + "!" /* ConditionalScope */
9254
9260
  );
9255
9261
  const source = initValue(
@@ -9258,8 +9264,8 @@ var dynamic_tag_default = {
9258
9264
  );
9259
9265
  source.register = true;
9260
9266
  source.buildAssignment = (valueSection, value) => {
9261
- return import_compiler52.types.callExpression(importRuntime("tagVarSignalChange"), [
9262
- import_compiler52.types.memberExpression(
9267
+ return import_compiler53.types.callExpression(importRuntime("tagVarSignalChange"), [
9268
+ import_compiler53.types.memberExpression(
9263
9269
  getScopeExpression(source.section, valueSection),
9264
9270
  childScopeLiteral,
9265
9271
  true
@@ -9271,7 +9277,7 @@ var dynamic_tag_default = {
9271
9277
  "render",
9272
9278
  section2,
9273
9279
  nodeRef2,
9274
- import_compiler52.types.expressionStatement(
9280
+ import_compiler53.types.expressionStatement(
9275
9281
  callRuntime(
9276
9282
  "setTagVar",
9277
9283
  scopeIdentifier,
@@ -9282,11 +9288,11 @@ var dynamic_tag_default = {
9282
9288
  );
9283
9289
  }
9284
9290
  if (args.length) {
9285
- const argsOrInput = hasMultipleArgs ? import_compiler52.types.arrayExpression(args) : args[0];
9286
- const attrsGetter = import_compiler52.types.arrowFunctionExpression(
9291
+ const argsOrInput = hasMultipleArgs ? import_compiler53.types.arrayExpression(args) : args[0];
9292
+ const attrsGetter = import_compiler53.types.arrowFunctionExpression(
9287
9293
  [],
9288
- statements.length ? import_compiler52.types.blockStatement(
9289
- statements.concat(import_compiler52.types.returnStatement(argsOrInput))
9294
+ statements.length ? import_compiler53.types.blockStatement(
9295
+ statements.concat(import_compiler53.types.returnStatement(argsOrInput))
9290
9296
  ) : argsOrInput
9291
9297
  );
9292
9298
  const id = currentProgramPath.scope.generateUidIdentifier(
@@ -9301,14 +9307,14 @@ var dynamic_tag_default = {
9301
9307
  if (!added) {
9302
9308
  currentProgramPath.pushContainer(
9303
9309
  "body",
9304
- import_compiler52.types.variableDeclaration("const", [
9305
- import_compiler52.types.variableDeclarator(
9310
+ import_compiler53.types.variableDeclaration("const", [
9311
+ import_compiler53.types.variableDeclarator(
9306
9312
  id,
9307
9313
  callRuntime(
9308
9314
  "dynamicTagAttrs",
9309
9315
  getScopeAccessorLiteral(nodeRef2),
9310
- bodySection && import_compiler52.types.identifier(bodySection.name),
9311
- hasMultipleArgs && import_compiler52.types.numericLiteral(1)
9316
+ bodySection && import_compiler53.types.identifier(bodySection.name),
9317
+ hasMultipleArgs && import_compiler53.types.numericLiteral(1)
9312
9318
  )
9313
9319
  )
9314
9320
  ])
@@ -9337,16 +9343,16 @@ var tag_default = {
9337
9343
  const { node } = tag;
9338
9344
  const { name: name2, attributes } = tag.node;
9339
9345
  let crawl = false;
9340
- if (import_compiler53.types.isStringLiteral(name2)) {
9346
+ if (import_compiler54.types.isStringLiteral(name2)) {
9341
9347
  const tagName = name2.value;
9342
9348
  if (tag.scope.getBinding(tagName) && TAG_NAME_IDENTIFIER_REG.test(tagName)) {
9343
- node.name = withPreviousLocation(import_compiler53.types.identifier(tagName), name2);
9349
+ node.name = withPreviousLocation(import_compiler54.types.identifier(tagName), name2);
9344
9350
  crawl = true;
9345
9351
  }
9346
9352
  }
9347
9353
  for (let i = 0; i < attributes.length; i++) {
9348
9354
  const attr2 = attributes[i];
9349
- if (import_compiler53.types.isMarkoAttribute(attr2) && attr2.bound) {
9355
+ if (import_compiler54.types.isMarkoAttribute(attr2) && attr2.bound) {
9350
9356
  attr2.bound = false;
9351
9357
  attributes.splice(++i, 0, getChangeHandler(tag, attr2));
9352
9358
  crawl = true;
@@ -9359,7 +9365,7 @@ var tag_default = {
9359
9365
  },
9360
9366
  analyze: {
9361
9367
  enter(tag) {
9362
- const tagDef = (0, import_babel_utils42.getTagDef)(tag);
9368
+ const tagDef = (0, import_babel_utils43.getTagDef)(tag);
9363
9369
  const type = analyzeTagNameType(tag);
9364
9370
  const hook = tagDef?.analyzer?.hook;
9365
9371
  if (hook) {
@@ -9383,7 +9389,7 @@ var tag_default = {
9383
9389
  }
9384
9390
  },
9385
9391
  exit(tag) {
9386
- const hook = (0, import_babel_utils42.getTagDef)(tag)?.analyzer?.hook;
9392
+ const hook = (0, import_babel_utils43.getTagDef)(tag)?.analyzer?.hook;
9387
9393
  if (hook) {
9388
9394
  exit(hook, tag);
9389
9395
  return;
@@ -9392,7 +9398,7 @@ var tag_default = {
9392
9398
  },
9393
9399
  translate: {
9394
9400
  enter(tag) {
9395
- const tagDef = (0, import_babel_utils42.getTagDef)(tag);
9401
+ const tagDef = (0, import_babel_utils43.getTagDef)(tag);
9396
9402
  const extra = tag.node.extra;
9397
9403
  if (tagDef?.translator) {
9398
9404
  if (tagDef.translator.path) {
@@ -9409,7 +9415,7 @@ var tag_default = {
9409
9415
  );
9410
9416
  }
9411
9417
  if (attr2.node.modifier) {
9412
- if ((0, import_babel_utils42.isNativeTag)(attr2.parentPath)) {
9418
+ if ((0, import_babel_utils43.isNativeTag)(attr2.parentPath)) {
9413
9419
  attr2.node.name += `:${attr2.node.modifier}`;
9414
9420
  } else {
9415
9421
  throw attr2.buildCodeFrameError(
@@ -9422,8 +9428,8 @@ var tag_default = {
9422
9428
  if (extra.tagNameDynamic && extra.tagNameNullable && !tag.get("name").isIdentifier() && isOutputHTML()) {
9423
9429
  const tagNameId = tag.scope.generateUidIdentifier("tagName");
9424
9430
  const [tagNameVarPath] = tag.insertBefore(
9425
- import_compiler53.types.variableDeclaration("const", [
9426
- import_compiler53.types.variableDeclarator(tagNameId, tag.node.name)
9431
+ import_compiler54.types.variableDeclaration("const", [
9432
+ import_compiler54.types.variableDeclarator(tagNameId, tag.node.name)
9427
9433
  ])
9428
9434
  );
9429
9435
  tagNameVarPath.skip();
@@ -9445,7 +9451,7 @@ var tag_default = {
9445
9451
  }
9446
9452
  },
9447
9453
  exit(tag) {
9448
- const translator = (0, import_babel_utils42.getTagDef)(tag)?.translator;
9454
+ const translator = (0, import_babel_utils43.getTagDef)(tag)?.translator;
9449
9455
  if (translator) {
9450
9456
  exit(translator.hook, tag);
9451
9457
  return;
@@ -9470,16 +9476,16 @@ var tag_default = {
9470
9476
  function getChangeHandler(tag, attr2) {
9471
9477
  const attrName = attr2.name;
9472
9478
  const changeAttrName = attrName + "Change";
9473
- if (import_compiler53.types.isIdentifier(attr2.value)) {
9479
+ if (import_compiler54.types.isIdentifier(attr2.value)) {
9474
9480
  const binding = tag.scope.getBinding(attr2.value.name);
9475
9481
  if (!binding)
9476
- return import_compiler53.types.markoAttribute(
9482
+ return import_compiler54.types.markoAttribute(
9477
9483
  changeAttrName,
9478
9484
  buildChangeHandlerFunction(attr2.value)
9479
9485
  );
9480
9486
  const existingChangedAttr = BINDING_CHANGE_HANDLER.get(binding.identifier);
9481
9487
  if (!existingChangedAttr) {
9482
- const changeHandlerAttr = import_compiler53.types.markoAttribute(
9488
+ const changeHandlerAttr = import_compiler54.types.markoAttribute(
9483
9489
  changeAttrName,
9484
9490
  buildChangeHandlerFunction(attr2.value)
9485
9491
  );
@@ -9487,10 +9493,10 @@ function getChangeHandler(tag, attr2) {
9487
9493
  return changeHandlerAttr;
9488
9494
  }
9489
9495
  if (existingChangedAttr.type === "Identifier") {
9490
- return import_compiler53.types.markoAttribute(
9496
+ return import_compiler54.types.markoAttribute(
9491
9497
  changeAttrName,
9492
9498
  withPreviousLocation(
9493
- import_compiler53.types.identifier(existingChangedAttr.name),
9499
+ import_compiler54.types.identifier(existingChangedAttr.name),
9494
9500
  attr2.value
9495
9501
  )
9496
9502
  );
@@ -9500,37 +9506,37 @@ function getChangeHandler(tag, attr2) {
9500
9506
  throw tag.hub.buildError(attr2.value, "Unable to bind to value.");
9501
9507
  }
9502
9508
  const changeHandlerId = markoRoot.scope.generateUid(changeAttrName);
9503
- const changeHandlerConst = import_compiler53.types.markoTag(
9504
- import_compiler53.types.stringLiteral("const"),
9505
- [import_compiler53.types.markoAttribute("value", existingChangedAttr.value, null, null, true)],
9506
- import_compiler53.types.markoTagBody([]),
9509
+ const changeHandlerConst = import_compiler54.types.markoTag(
9510
+ import_compiler54.types.stringLiteral("const"),
9511
+ [import_compiler54.types.markoAttribute("value", existingChangedAttr.value, null, null, true)],
9512
+ import_compiler54.types.markoTagBody([]),
9507
9513
  null,
9508
- import_compiler53.types.identifier(changeHandlerId)
9514
+ import_compiler54.types.identifier(changeHandlerId)
9509
9515
  );
9510
9516
  BINDING_CHANGE_HANDLER.set(
9511
9517
  binding.identifier,
9512
- existingChangedAttr.value = import_compiler53.types.identifier(changeHandlerId)
9518
+ existingChangedAttr.value = import_compiler54.types.identifier(changeHandlerId)
9513
9519
  );
9514
9520
  if (markoRoot.isMarkoTag()) {
9515
9521
  markoRoot.insertAfter(changeHandlerConst);
9516
9522
  } else {
9517
9523
  markoRoot.unshiftContainer("body", changeHandlerConst);
9518
9524
  }
9519
- return import_compiler53.types.markoAttribute(
9525
+ return import_compiler54.types.markoAttribute(
9520
9526
  changeAttrName,
9521
- withPreviousLocation(import_compiler53.types.identifier(changeHandlerId), attr2.value)
9527
+ withPreviousLocation(import_compiler54.types.identifier(changeHandlerId), attr2.value)
9522
9528
  );
9523
- } else if (import_compiler53.types.isMemberExpression(attr2.value)) {
9529
+ } else if (import_compiler54.types.isMemberExpression(attr2.value)) {
9524
9530
  const prop = attr2.value.property;
9525
- if (!import_compiler53.types.isPrivateName(attr2.value.property)) {
9526
- return import_compiler53.types.markoAttribute(
9531
+ if (!import_compiler54.types.isPrivateName(attr2.value.property)) {
9532
+ return import_compiler54.types.markoAttribute(
9527
9533
  changeAttrName,
9528
- import_compiler53.types.memberExpression(
9529
- import_compiler53.types.cloneNode(attr2.value.object),
9530
- prop.type === "Identifier" ? withPreviousLocation(import_compiler53.types.identifier(prop.name + "Change"), prop) : import_compiler53.types.binaryExpression(
9534
+ import_compiler54.types.memberExpression(
9535
+ import_compiler54.types.cloneNode(attr2.value.object),
9536
+ prop.type === "Identifier" ? withPreviousLocation(import_compiler54.types.identifier(prop.name + "Change"), prop) : import_compiler54.types.binaryExpression(
9531
9537
  "+",
9532
- import_compiler53.types.cloneNode(prop),
9533
- import_compiler53.types.stringLiteral("Change")
9538
+ import_compiler54.types.cloneNode(prop),
9539
+ import_compiler54.types.stringLiteral("Change")
9534
9540
  ),
9535
9541
  prop.type !== "Identifier"
9536
9542
  )
@@ -9544,14 +9550,14 @@ function getChangeHandler(tag, attr2) {
9544
9550
  }
9545
9551
  function buildChangeHandlerFunction(id) {
9546
9552
  const newId = "_new_" + id.name;
9547
- return import_compiler53.types.arrowFunctionExpression(
9548
- [withPreviousLocation(import_compiler53.types.identifier(newId), id)],
9549
- import_compiler53.types.blockStatement([
9550
- import_compiler53.types.expressionStatement(
9551
- import_compiler53.types.assignmentExpression(
9553
+ return import_compiler54.types.arrowFunctionExpression(
9554
+ [withPreviousLocation(import_compiler54.types.identifier(newId), id)],
9555
+ import_compiler54.types.blockStatement([
9556
+ import_compiler54.types.expressionStatement(
9557
+ import_compiler54.types.assignmentExpression(
9552
9558
  "=",
9553
- withPreviousLocation(import_compiler53.types.identifier(id.name), id),
9554
- withPreviousLocation(import_compiler53.types.identifier(newId), id)
9559
+ withPreviousLocation(import_compiler54.types.identifier(id.name), id),
9560
+ withPreviousLocation(import_compiler54.types.identifier(newId), id)
9555
9561
  )
9556
9562
  )
9557
9563
  ])
@@ -9559,7 +9565,7 @@ function buildChangeHandlerFunction(id) {
9559
9565
  }
9560
9566
 
9561
9567
  // src/translator/visitors/text.ts
9562
- var import_compiler54 = require("@marko/compiler");
9568
+ var import_compiler55 = require("@marko/compiler");
9563
9569
  var text_default = {
9564
9570
  translate: {
9565
9571
  exit(text) {