marko 6.0.161 → 6.0.163

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.
@@ -114,7 +114,7 @@ var attrs_default = {
114
114
 
115
115
  // src/translator/core/await.ts
116
116
  var import_compiler39 = require("@marko/compiler");
117
- var import_babel_utils28 = require("@marko/compiler/babel-utils");
117
+ var import_babel_utils29 = require("@marko/compiler/babel-utils");
118
118
 
119
119
  // src/common/accessor.debug.ts
120
120
  var AccessorPrefix = /* @__PURE__ */ ((AccessorPrefix4) => {
@@ -252,7 +252,7 @@ function isNullableExpr(expr) {
252
252
 
253
253
  // src/translator/util/references.ts
254
254
  var import_compiler38 = require("@marko/compiler");
255
- var import_babel_utils27 = require("@marko/compiler/babel-utils");
255
+ var import_babel_utils28 = require("@marko/compiler/babel-utils");
256
256
  var import_config = require("@marko/compiler/config");
257
257
 
258
258
  // src/common/helpers.ts
@@ -580,12 +580,12 @@ var import_babel_utils4 = require("@marko/compiler/babel-utils");
580
580
 
581
581
  // src/translator/util/get-compile-stage.ts
582
582
  var import_babel_utils3 = require("@marko/compiler/babel-utils");
583
- function getCompileStage() {
584
- return (0, import_babel_utils3.getFile)().___compileStage;
585
- }
586
583
  function isTranslate() {
587
584
  return getCompileStage() === "translate" /* translate */;
588
585
  }
586
+ function getCompileStage() {
587
+ return (0, import_babel_utils3.getFile)().___compileStage;
588
+ }
589
589
 
590
590
  // src/translator/util/traverse.ts
591
591
  var import_compiler2 = require("@marko/compiler");
@@ -716,7 +716,7 @@ function getInitialCounts(file) {
716
716
  const counts = /* @__PURE__ */ new Map();
717
717
  const program = file.path;
718
718
  const countName = (name2) => {
719
- const match = /^$(.*?)([1-9]\d*)?$/.exec(name2);
719
+ const match = /^\$(.*?)([1-9]\d*)?$/.exec(name2);
720
720
  if (match) {
721
721
  const name3 = match[1];
722
722
  const count = match[2] ? +match[2] + 1 : 1;
@@ -1583,7 +1583,7 @@ function setPropSerializeReason(section, key, reason) {
1583
1583
 
1584
1584
  // src/translator/util/state.ts
1585
1585
  var import_babel_utils8 = require("@marko/compiler/babel-utils");
1586
- var createProgramState = (init) => {
1586
+ function createProgramState(init) {
1587
1587
  const map = /* @__PURE__ */ new WeakMap();
1588
1588
  return [
1589
1589
  () => {
@@ -1597,7 +1597,7 @@ var createProgramState = (init) => {
1597
1597
  map.set((0, import_babel_utils8.getProgram)(), value);
1598
1598
  }
1599
1599
  ];
1600
- };
1600
+ }
1601
1601
  function createSectionState(key, init) {
1602
1602
  return [
1603
1603
  (section) => {
@@ -1801,10 +1801,6 @@ var [getScopeIdIdentifier] = createSectionState(
1801
1801
  (section) => generateUidIdentifier(`scope${section.id}_id`)
1802
1802
  );
1803
1803
  var [getSectionParentIsOwner, setSectionParentIsOwner] = createSectionState("parentIsOwner", () => false);
1804
- var [_getScopeIdentifier] = createSectionState(
1805
- "scopeIdentifier",
1806
- () => import_compiler7.types.identifier("undefined")
1807
- );
1808
1804
  var [getBranchRendererArgs, setBranchRendererArgs] = createSectionState("rendererExpression");
1809
1805
  function forEachSection(fn) {
1810
1806
  const { sections } = (0, import_babel_utils10.getProgram)().node.extra;
@@ -2178,8 +2174,7 @@ function isStaticRoot(path7) {
2178
2174
 
2179
2175
  // src/translator/visitors/program/index.ts
2180
2176
  var import_compiler27 = require("@marko/compiler");
2181
- var import_babel_utils18 = require("@marko/compiler/babel-utils");
2182
- var import_path2 = __toESM(require("path"));
2177
+ var import_babel_utils19 = require("@marko/compiler/babel-utils");
2183
2178
 
2184
2179
  // src/translator/util/binding-prop-tree.ts
2185
2180
  function getBindingPropTree(binding) {
@@ -2314,9 +2309,19 @@ var entry_builder_default = {
2314
2309
  }
2315
2310
  };
2316
2311
 
2312
+ // src/translator/util/resolve-relative-to-entry.ts
2313
+ var import_babel_utils13 = require("@marko/compiler/babel-utils");
2314
+ var import_path = __toESM(require("path"));
2315
+ function resolveRelativeToEntry(entryFile, file, req) {
2316
+ return file === entryFile ? (0, import_babel_utils13.resolveRelativePath)(file, req) : (0, import_babel_utils13.resolveRelativePath)(
2317
+ entryFile,
2318
+ req[0] === "." ? import_path.default.join(file.opts.filename, "..", req) : req
2319
+ );
2320
+ }
2321
+
2317
2322
  // src/translator/util/runtime.ts
2318
2323
  var import_compiler11 = require("@marko/compiler");
2319
- var import_babel_utils13 = require("@marko/compiler/babel-utils");
2324
+ var import_babel_utils14 = require("@marko/compiler/babel-utils");
2320
2325
 
2321
2326
  // src/common/errors.ts
2322
2327
  function assertExclusiveAttrs(attrs, onError = throwErr) {
@@ -2503,7 +2508,7 @@ var pureDOMFunctions = /* @__PURE__ */ new Set([
2503
2508
  function importRuntime(name2) {
2504
2509
  const { output } = getMarkoOpts();
2505
2510
  return toMemberExpression(
2506
- (0, import_babel_utils13.importStar)((0, import_babel_utils13.getFile)(), getRuntimePath(output), "_"),
2511
+ (0, import_babel_utils14.importStar)((0, import_babel_utils14.getFile)(), getRuntimePath(output), "_"),
2507
2512
  name2
2508
2513
  );
2509
2514
  }
@@ -2554,7 +2559,7 @@ function getCompatRuntimeFile() {
2554
2559
 
2555
2560
  // src/translator/visitors/program/dom.ts
2556
2561
  var import_compiler23 = require("@marko/compiler");
2557
- var import_babel_utils16 = require("@marko/compiler/babel-utils");
2562
+ var import_babel_utils17 = require("@marko/compiler/babel-utils");
2558
2563
 
2559
2564
  // src/translator/util/binding-has-prop.ts
2560
2565
  function bindingHasProperty(binding, properties) {
@@ -2587,7 +2592,7 @@ function bindingHasProperty(binding, properties) {
2587
2592
  }
2588
2593
 
2589
2594
  // src/translator/util/get-style-file.ts
2590
- var import_path = __toESM(require("path"));
2595
+ var import_path2 = __toESM(require("path"));
2591
2596
  function getStyleFile(file) {
2592
2597
  const { filename } = file.opts;
2593
2598
  const fs = file.markoOpts.fileSystem;
@@ -2595,14 +2600,14 @@ function getStyleFile(file) {
2595
2600
  const styleMatch = new RegExp(
2596
2601
  `^(${escapeRegExp(base)}\\.${"index" === base ? "|" : ""})style\\.\\w+$`
2597
2602
  );
2598
- for (const file2 of fs.readdirSync(import_path.default.dirname(filename)).sort()) {
2603
+ for (const file2 of fs.readdirSync(import_path2.default.dirname(filename)).sort()) {
2599
2604
  if (styleMatch.test(file2)) {
2600
2605
  return `./${file2}`;
2601
2606
  }
2602
2607
  }
2603
2608
  }
2604
2609
  function getBase(filename) {
2605
- const start = filename.lastIndexOf(import_path.default.sep) + 1;
2610
+ const start = filename.lastIndexOf(import_path2.default.sep) + 1;
2606
2611
  const leftDot = filename.indexOf(".", start);
2607
2612
  if (leftDot === -1) {
2608
2613
  return filename.slice(start);
@@ -2624,11 +2629,11 @@ function escapeRegExp(str) {
2624
2629
 
2625
2630
  // src/translator/util/signals.ts
2626
2631
  var import_compiler22 = require("@marko/compiler");
2627
- var import_babel_utils15 = require("@marko/compiler/babel-utils");
2632
+ var import_babel_utils16 = require("@marko/compiler/babel-utils");
2628
2633
 
2629
2634
  // src/translator/core/return.ts
2630
2635
  var import_compiler17 = require("@marko/compiler");
2631
- var import_babel_utils14 = require("@marko/compiler/babel-utils");
2636
+ var import_babel_utils15 = require("@marko/compiler/babel-utils");
2632
2637
 
2633
2638
  // src/translator/util/get-known-attr-values.ts
2634
2639
  function getKnownAttrValues(tag) {
@@ -3177,14 +3182,14 @@ function unwrapWrite(write) {
3177
3182
  var [getSectionReturnValueIdentifier, setReturnValueIdentifier] = createSectionState("returnValue");
3178
3183
  var return_default = {
3179
3184
  analyze(tag) {
3180
- (0, import_babel_utils14.assertNoArgs)(tag);
3181
- (0, import_babel_utils14.assertNoVar)(tag);
3182
- (0, import_babel_utils14.assertNoParams)(tag);
3185
+ (0, import_babel_utils15.assertNoArgs)(tag);
3186
+ (0, import_babel_utils15.assertNoVar)(tag);
3187
+ (0, import_babel_utils15.assertNoParams)(tag);
3183
3188
  assertNoBodyContent(tag);
3184
- (0, import_babel_utils14.assertAllowedAttributes)(tag, ["value", "valueChange"]);
3189
+ (0, import_babel_utils15.assertAllowedAttributes)(tag, ["value", "valueChange"]);
3185
3190
  const parentTag = getParentTag(tag);
3186
3191
  if (parentTag) {
3187
- if ((0, import_babel_utils14.isNativeTag)(parentTag)) {
3192
+ if ((0, import_babel_utils15.isNativeTag)(parentTag)) {
3188
3193
  throw tag.get("name").buildCodeFrameError(
3189
3194
  "The [`<return>` tag](https://markojs.com/docs/reference/core-tag#return) can not be used in a [native tag](https://markojs.com/docs/reference/native-tag)."
3190
3195
  );
@@ -3353,7 +3358,7 @@ function forEachIdentifierPath(nodePath, cb) {
3353
3358
  }
3354
3359
  }
3355
3360
 
3356
- // src/translator/util/get-defined-binding-expression.ts
3361
+ // src/translator/util/get-declared-binding-expression.ts
3357
3362
  var import_compiler18 = require("@marko/compiler");
3358
3363
  function getDeclaredBindingExpression(binding) {
3359
3364
  const canonicalBinding = getCanonicalBinding(binding);
@@ -3522,7 +3527,7 @@ function getSignal(section, referencedBindings, name2) {
3522
3527
  let signal = signals.get(referencedBindings);
3523
3528
  if (!signal) {
3524
3529
  const signalName = name2 ?? (referencedBindings ? getDebugNamesAsIdentifier(referencedBindings) : "setup");
3525
- const exportName = referencedBindings ? !Array.isArray(referencedBindings) && referencedBindings.section === section && referencedBindings.export : !section.parent && (0, import_babel_utils15.getProgram)().node.extra.domExports?.setup;
3530
+ const exportName = referencedBindings ? !Array.isArray(referencedBindings) && referencedBindings.section === section && referencedBindings.export : !section.parent && (0, import_babel_utils16.getProgram)().node.extra.domExports?.setup;
3526
3531
  signals.set(
3527
3532
  referencedBindings,
3528
3533
  signal = {
@@ -3941,7 +3946,7 @@ function getResumeRegisterId(section, referencedBindings, type) {
3941
3946
  const {
3942
3947
  markoOpts,
3943
3948
  opts: { filename }
3944
- } = (0, import_babel_utils15.getFile)();
3949
+ } = (0, import_babel_utils16.getFile)();
3945
3950
  let name2 = "";
3946
3951
  if (referencedBindings) {
3947
3952
  if (typeof referencedBindings === "string") {
@@ -3954,7 +3959,7 @@ function getResumeRegisterId(section, referencedBindings, type) {
3954
3959
  name2 += `_${referencedBindings.name}`;
3955
3960
  }
3956
3961
  }
3957
- return (0, import_babel_utils15.getTemplateId)(
3962
+ return (0, import_babel_utils16.getTemplateId)(
3958
3963
  markoOpts,
3959
3964
  filename,
3960
3965
  `${section.id}${name2}${type ? "/" + type : ""}`
@@ -4031,7 +4036,7 @@ function writeSignals(section) {
4031
4036
  if (signalDeclaration) {
4032
4037
  signalStatements.push(signalDeclaration);
4033
4038
  }
4034
- (0, import_babel_utils15.getProgram)().node.body.push(...signalStatements);
4039
+ (0, import_babel_utils16.getProgram)().node.body.push(...signalStatements);
4035
4040
  written.add(signal);
4036
4041
  }
4037
4042
  return written;
@@ -4056,7 +4061,7 @@ function writeGetters(section) {
4056
4061
  currentSection = parentSection;
4057
4062
  }
4058
4063
  }
4059
- (0, import_babel_utils15.getProgram)().node.body.push(
4064
+ (0, import_babel_utils16.getProgram)().node.body.push(
4060
4065
  import_compiler22.types.variableDeclaration("const", [
4061
4066
  import_compiler22.types.variableDeclarator(
4062
4067
  getterIdentifier,
@@ -4078,7 +4083,7 @@ function writeGetters(section) {
4078
4083
  });
4079
4084
  }
4080
4085
  function writeRegisteredFns() {
4081
- const registeredFns = registeredFnsForProgram.get((0, import_babel_utils15.getProgram)().node);
4086
+ const registeredFns = registeredFnsForProgram.get((0, import_babel_utils16.getProgram)().node);
4082
4087
  const statements = [];
4083
4088
  if (registeredFns) {
4084
4089
  for (const registeredFn of registeredFns) {
@@ -4113,7 +4118,7 @@ function writeRegisteredFns() {
4113
4118
  )
4114
4119
  );
4115
4120
  }
4116
- (0, import_babel_utils15.getProgram)().node.body.push(...statements);
4121
+ (0, import_babel_utils16.getProgram)().node.body.push(...statements);
4117
4122
  }
4118
4123
  }
4119
4124
  function toReturnedFunction(rawFn) {
@@ -4156,12 +4161,15 @@ function writeHTMLResumeStatements(path7) {
4156
4161
  getAccessorPrefix().ClosureScopes
4157
4162
  );
4158
4163
  }
4159
- setBindingSerializedValue(
4160
- section,
4161
- closure,
4162
- import_compiler22.types.numericLiteral(getDynamicClosureIndex(closure, section)),
4163
- getAccessorPrefix().ClosureSignalIndex
4164
- );
4164
+ const closureIndex = getDynamicClosureIndex(closure, section);
4165
+ if (closureIndex) {
4166
+ setBindingSerializedValue(
4167
+ section,
4168
+ closure,
4169
+ import_compiler22.types.numericLiteral(closureIndex),
4170
+ getAccessorPrefix().ClosureSignalIndex
4171
+ );
4172
+ }
4165
4173
  if (underTryPlaceholder(section)) {
4166
4174
  const reason = getSerializeReason(section);
4167
4175
  if (reason) {
@@ -4533,9 +4541,9 @@ function getRegisteredFnExpression(node) {
4533
4541
  const id = extra.name;
4534
4542
  const referencesScope = extra.referencesScope;
4535
4543
  const referencedBindings = extra.referencedBindingsInFunction;
4536
- let registeredFns = registeredFnsForProgram.get((0, import_babel_utils15.getProgram)().node);
4544
+ let registeredFns = registeredFnsForProgram.get((0, import_babel_utils16.getProgram)().node);
4537
4545
  if (!registeredFns) {
4538
- registeredFnsForProgram.set((0, import_babel_utils15.getProgram)().node, registeredFns = []);
4546
+ registeredFnsForProgram.set((0, import_babel_utils16.getProgram)().node, registeredFns = []);
4539
4547
  }
4540
4548
  registeredFns.push({
4541
4549
  id,
@@ -4597,7 +4605,7 @@ var dom_default = {
4597
4605
  let extraDecls = decls;
4598
4606
  const styleFile = getStyleFile(program.hub.file);
4599
4607
  if (styleFile) {
4600
- (0, import_babel_utils16.importDefault)(program.hub.file, styleFile);
4608
+ (0, import_babel_utils17.importDefault)(program.hub.file, styleFile);
4601
4609
  }
4602
4610
  forEachSectionReverse((childSection) => {
4603
4611
  if (childSection !== section) {
@@ -4947,7 +4955,7 @@ function getRegisteredFnExpression2(node) {
4947
4955
 
4948
4956
  // src/translator/visitors/program/pre-analyze.ts
4949
4957
  var import_compiler26 = require("@marko/compiler");
4950
- var import_babel_utils17 = require("@marko/compiler/babel-utils");
4958
+ var import_babel_utils18 = require("@marko/compiler/babel-utils");
4951
4959
 
4952
4960
  // src/translator/core/textarea.ts
4953
4961
  var import_compiler25 = require("@marko/compiler");
@@ -5021,7 +5029,7 @@ function normalizeTag(tag) {
5021
5029
  const tagName = name2.value;
5022
5030
  if (tag.scope.getBinding(tagName) && TAG_NAME_IDENTIFIER_REG.test(tagName)) {
5023
5031
  node.name = withPreviousLocation(import_compiler26.types.identifier(tagName), name2);
5024
- } else if ((0, import_babel_utils17.isNativeTag)(tag)) {
5032
+ } else if ((0, import_babel_utils18.isNativeTag)(tag)) {
5025
5033
  attrNameReg = htmlAttrNameReg;
5026
5034
  switch (tagName) {
5027
5035
  case "textarea":
@@ -5365,12 +5373,12 @@ var program_default = {
5365
5373
  if (getMarkoOpts().output === "hydrate") {
5366
5374
  const entryFile = program.hub.file;
5367
5375
  const visitedFiles = /* @__PURE__ */ new Set([
5368
- (0, import_babel_utils18.resolveRelativePath)(entryFile, entryFile.opts.filename)
5376
+ (0, import_babel_utils19.resolveRelativePath)(entryFile, entryFile.opts.filename)
5369
5377
  ]);
5370
5378
  entry_builder_default.visit(entryFile, entryFile, function visitChild(resolved) {
5371
5379
  if (!visitedFiles.has(resolved)) {
5372
5380
  visitedFiles.add(resolved);
5373
- const file = (0, import_babel_utils18.loadFileForImport)(entryFile, resolved);
5381
+ const file = (0, import_babel_utils19.loadFileForImport)(entryFile, resolved);
5374
5382
  if (file) {
5375
5383
  entry_builder_default.visit(
5376
5384
  file,
@@ -5412,12 +5420,6 @@ var program_default = {
5412
5420
  }
5413
5421
  }
5414
5422
  };
5415
- function resolveRelativeToEntry(entryFile, file, req) {
5416
- return file === entryFile ? (0, import_babel_utils18.resolveRelativePath)(file, req) : (0, import_babel_utils18.resolveRelativePath)(
5417
- entryFile,
5418
- req[0] === "." ? import_path2.default.join(file.opts.filename, "..", req) : req
5419
- );
5420
- }
5421
5423
 
5422
5424
  // src/translator/util/is-event-or-change-handler.ts
5423
5425
  function isEventOrChangeHandler(prop) {
@@ -5426,11 +5428,11 @@ function isEventOrChangeHandler(prop) {
5426
5428
 
5427
5429
  // src/translator/util/known-tag.ts
5428
5430
  var import_compiler37 = require("@marko/compiler");
5429
- var import_babel_utils26 = require("@marko/compiler/babel-utils");
5431
+ var import_babel_utils27 = require("@marko/compiler/babel-utils");
5430
5432
 
5431
5433
  // src/translator/util/nested-attribute-tags.ts
5432
5434
  var import_compiler28 = require("@marko/compiler");
5433
- var import_babel_utils19 = require("@marko/compiler/babel-utils");
5435
+ var import_babel_utils20 = require("@marko/compiler/babel-utils");
5434
5436
  var attrTagToIdentifierLookup = /* @__PURE__ */ new WeakMap();
5435
5437
  function getAttrTagIdentifier(meta) {
5436
5438
  let name2 = attrTagToIdentifierLookup.get(meta);
@@ -5440,9 +5442,12 @@ function getAttrTagIdentifier(meta) {
5440
5442
  }
5441
5443
  return import_compiler28.types.identifier(name2);
5442
5444
  }
5445
+ function getAttrTagPaths(tag) {
5446
+ return tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
5447
+ }
5443
5448
  function analyzeAttributeTags(tag) {
5444
5449
  if (tag.node.extra?.attributeTags) return tag.node.extra.attributeTags;
5445
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
5450
+ const attrTags2 = getAttrTagPaths(tag);
5446
5451
  if (!attrTags2.length) return;
5447
5452
  const tagExtra = tag.node.extra ??= {};
5448
5453
  const lookup = tagExtra.attributeTags = {};
@@ -5450,13 +5455,13 @@ function analyzeAttributeTags(tag) {
5450
5455
  const sampleAttrTagsForControlFlow = /* @__PURE__ */ new Map();
5451
5456
  for (const child of attrTags2) {
5452
5457
  if (child.isMarkoTag()) {
5453
- if ((0, import_babel_utils19.isAttributeTag)(child)) {
5458
+ if ((0, import_babel_utils20.isAttributeTag)(child)) {
5454
5459
  const name2 = getTagName(child);
5455
5460
  lookup[name2] ||= createAttrTagMeta(name2, [name2]);
5456
5461
  (attrTagNodesByName[name2] ||= []).push(child);
5457
5462
  analyzeAttributeTags(child);
5458
5463
  } else {
5459
- const isRepeated = (0, import_babel_utils19.isLoopTag)(child);
5464
+ const isRepeated = (0, import_babel_utils20.isLoopTag)(child);
5460
5465
  let curGroup;
5461
5466
  for (const name2 of crawlAttrTags(child, attrTagNodesByName)) {
5462
5467
  const oldMeta = lookup[name2];
@@ -5508,10 +5513,10 @@ function createAttrTagMeta(name2, group) {
5508
5513
  };
5509
5514
  }
5510
5515
  function crawlAttrTags(tag, attrTagNodesByName, attrTagNames = /* @__PURE__ */ new Set()) {
5511
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
5516
+ const attrTags2 = getAttrTagPaths(tag);
5512
5517
  for (const child of attrTags2) {
5513
5518
  if (child.isMarkoTag()) {
5514
- if ((0, import_babel_utils19.isAttributeTag)(child)) {
5519
+ if ((0, import_babel_utils20.isAttributeTag)(child)) {
5515
5520
  const tagName = getTagName(child);
5516
5521
  attrTagNames.add(tagName);
5517
5522
  (attrTagNodesByName[tagName] ||= []).push(child);
@@ -5552,7 +5557,7 @@ function getConditionRoot(tag) {
5552
5557
 
5553
5558
  // src/translator/util/set-tag-sections-downstream.ts
5554
5559
  var import_compiler29 = require("@marko/compiler");
5555
- var import_babel_utils20 = require("@marko/compiler/babel-utils");
5560
+ var import_babel_utils21 = require("@marko/compiler/babel-utils");
5556
5561
  var [getTagDownstreams] = createSectionState(
5557
5562
  "tag-downstreams",
5558
5563
  () => /* @__PURE__ */ new Map()
@@ -5579,10 +5584,10 @@ function crawlSectionsAndSetBinding(tag, binding, properties, skip2) {
5579
5584
  }
5580
5585
  const attrTagLookup = analyzeAttributeTags(tag);
5581
5586
  if (!attrTagLookup) return;
5582
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
5587
+ const attrTags2 = getAttrTagPaths(tag);
5583
5588
  for (const child of attrTags2) {
5584
5589
  if (child.isMarkoTag()) {
5585
- if ((0, import_babel_utils20.isAttributeTag)(child)) {
5590
+ if ((0, import_babel_utils21.isAttributeTag)(child)) {
5586
5591
  const attrTagMeta = attrTagLookup[getTagName(child)];
5587
5592
  crawlSectionsAndSetBinding(
5588
5593
  child,
@@ -5598,19 +5603,19 @@ function crawlSectionsAndSetBinding(tag, binding, properties, skip2) {
5598
5603
 
5599
5604
  // src/translator/util/translate-attrs.ts
5600
5605
  var import_compiler35 = require("@marko/compiler");
5601
- var import_babel_utils25 = require("@marko/compiler/babel-utils");
5606
+ var import_babel_utils26 = require("@marko/compiler/babel-utils");
5602
5607
 
5603
5608
  // src/translator/core/for.ts
5604
5609
  var import_compiler34 = require("@marko/compiler");
5605
- var import_babel_utils24 = require("@marko/compiler/babel-utils");
5610
+ var import_babel_utils25 = require("@marko/compiler/babel-utils");
5606
5611
 
5607
5612
  // src/translator/util/is-only-child-in-parent.ts
5608
5613
  var import_compiler33 = require("@marko/compiler");
5609
- var import_babel_utils23 = require("@marko/compiler/babel-utils");
5614
+ var import_babel_utils24 = require("@marko/compiler/babel-utils");
5610
5615
 
5611
5616
  // src/translator/visitors/tag/native-tag.ts
5612
5617
  var import_compiler32 = require("@marko/compiler");
5613
- var import_babel_utils22 = require("@marko/compiler/babel-utils");
5618
+ var import_babel_utils23 = require("@marko/compiler/babel-utils");
5614
5619
 
5615
5620
  // src/translator/util/body-to-text-literal.ts
5616
5621
  var import_compiler30 = require("@marko/compiler");
@@ -5649,7 +5654,7 @@ function templateElement(value, tail) {
5649
5654
 
5650
5655
  // src/translator/util/is-non-html-text.ts
5651
5656
  var import_compiler31 = require("@marko/compiler");
5652
- var import_babel_utils21 = require("@marko/compiler/babel-utils");
5657
+ var import_babel_utils22 = require("@marko/compiler/babel-utils");
5653
5658
  function isNonHTMLText(placeholder) {
5654
5659
  const parentTag = placeholder.parentPath.isMarkoTagBody() && placeholder.parentPath.parentPath;
5655
5660
  if (parentTag) {
@@ -5667,7 +5672,7 @@ function isNonHTMLText(placeholder) {
5667
5672
  return false;
5668
5673
  }
5669
5674
  function isTextOnlyNativeTag(tag) {
5670
- const def = (0, import_babel_utils21.getTagDef)(tag);
5675
+ const def = (0, import_babel_utils22.getTagDef)(tag);
5671
5676
  return !!(def && def.html && (def.name === "title" || def.parseOptions?.text));
5672
5677
  }
5673
5678
 
@@ -5679,9 +5684,9 @@ var htmlSelectArgs = /* @__PURE__ */ new WeakMap();
5679
5684
  var native_tag_default = {
5680
5685
  analyze: {
5681
5686
  enter(tag) {
5682
- (0, import_babel_utils22.assertNoArgs)(tag);
5683
- (0, import_babel_utils22.assertNoParams)(tag);
5684
- (0, import_babel_utils22.assertNoAttributeTags)(tag);
5687
+ (0, import_babel_utils23.assertNoArgs)(tag);
5688
+ (0, import_babel_utils23.assertNoParams)(tag);
5689
+ (0, import_babel_utils23.assertNoAttributeTags)(tag);
5685
5690
  const { node } = tag;
5686
5691
  if (node.var && !import_compiler32.types.isIdentifier(node.var)) {
5687
5692
  throw tag.get("var").buildCodeFrameError(
@@ -5693,7 +5698,7 @@ var native_tag_default = {
5693
5698
  case "html":
5694
5699
  case "body":
5695
5700
  case "head":
5696
- (0, import_babel_utils22.getProgram)().node.extra.page ??= true;
5701
+ (0, import_babel_utils23.getProgram)().node.extra.page ??= true;
5697
5702
  break;
5698
5703
  }
5699
5704
  const isTextOnly = isTextOnlyNativeTag(tag);
@@ -5767,7 +5772,7 @@ var native_tag_default = {
5767
5772
  !!node.var
5768
5773
  );
5769
5774
  if (hasEventHandlers) {
5770
- (0, import_babel_utils22.getProgram)().node.extra.isInteractive = true;
5775
+ (0, import_babel_utils23.getProgram)().node.extra.isInteractive = true;
5771
5776
  }
5772
5777
  if (spreadReferenceNodes) {
5773
5778
  if (relatedControllable && !relatedControllable.attrs.every(Boolean)) {
@@ -5815,7 +5820,7 @@ var native_tag_default = {
5815
5820
  const tagName = getCanonicalTagName(tag);
5816
5821
  const tagExtra = tag.node.extra;
5817
5822
  const nodeBinding = tagExtra[kNativeTagBinding];
5818
- const tagDef = (0, import_babel_utils22.getTagDef)(tag);
5823
+ const tagDef = (0, import_babel_utils23.getTagDef)(tag);
5819
5824
  const write = writeTo(tag);
5820
5825
  const tagSection = getSection(tag);
5821
5826
  const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
@@ -5895,7 +5900,7 @@ var native_tag_default = {
5895
5900
  if (valueChange) {
5896
5901
  writeAtStartOfBody = callRuntime(
5897
5902
  "_attr_textarea_value",
5898
- getScopeIdIdentifier(getSection(tag)),
5903
+ getScopeIdIdentifier(tagSection),
5899
5904
  visitAccessor,
5900
5905
  value,
5901
5906
  valueChange
@@ -6029,7 +6034,7 @@ var native_tag_default = {
6029
6034
  exit(tag) {
6030
6035
  const tagExtra = tag.node.extra;
6031
6036
  const nodeBinding = tagExtra[kNativeTagBinding];
6032
- const isOpenOnly = (0, import_babel_utils22.getTagDef)(tag)?.parseOptions?.openTagOnly;
6037
+ const isOpenOnly = (0, import_babel_utils23.getTagDef)(tag)?.parseOptions?.openTagOnly;
6033
6038
  const isTextOnly = isTextOnlyNativeTag(tag);
6034
6039
  const selectArgs = htmlSelectArgs.get(tag.node);
6035
6040
  const tagName = getCanonicalTagName(tag);
@@ -6051,7 +6056,7 @@ var native_tag_default = {
6051
6056
  import_compiler32.types.expressionStatement(
6052
6057
  callRuntime(
6053
6058
  "_attr_select_value",
6054
- getScopeIdIdentifier(getSection(tag)),
6059
+ getScopeIdIdentifier(tagSection),
6055
6060
  nodeBinding && getScopeAccessorLiteral(nodeBinding),
6056
6061
  selectArgs.value,
6057
6062
  selectArgs.valueChange,
@@ -6087,7 +6092,7 @@ var native_tag_default = {
6087
6092
  const tagName = getCanonicalTagName(tag);
6088
6093
  const tagExtra = tag.node.extra;
6089
6094
  const nodeBinding = tagExtra[kNativeTagBinding];
6090
- const tagDef = (0, import_babel_utils22.getTagDef)(tag);
6095
+ const tagDef = (0, import_babel_utils23.getTagDef)(tag);
6091
6096
  const write = writeTo(tag);
6092
6097
  const tagSection = getSection(tag);
6093
6098
  const visitAccessor = nodeBinding && getScopeAccessorLiteral(nodeBinding);
@@ -6340,7 +6345,7 @@ var native_tag_default = {
6340
6345
  exit(tag) {
6341
6346
  const tagExtra = tag.node.extra;
6342
6347
  const nodeBinding = tagExtra[kNativeTagBinding];
6343
- const openTagOnly = (0, import_babel_utils22.getTagDef)(tag)?.parseOptions?.openTagOnly;
6348
+ const openTagOnly = (0, import_babel_utils23.getTagDef)(tag)?.parseOptions?.openTagOnly;
6344
6349
  const tagName = getCanonicalTagName(tag);
6345
6350
  if (!openTagOnly) {
6346
6351
  const write = writeTo(tag);
@@ -6662,7 +6667,7 @@ function getOnlyChildParentTagName(tag, branchSize = 1) {
6662
6667
  return extra[kOnlyChildInParent];
6663
6668
  }
6664
6669
  const parentTag = getParentTag(tag);
6665
- return extra[kOnlyChildInParent] = parentTag && (0, import_babel_utils23.getTagDef)(parentTag)?.html && parentTag.node.name.type === "StringLiteral" && tag.parent.body.filter(
6670
+ return extra[kOnlyChildInParent] = parentTag && (0, import_babel_utils24.getTagDef)(parentTag)?.html && parentTag.node.name.type === "StringLiteral" && tag.parent.body.filter(
6666
6671
  (node) => node.type !== "MarkoComment"
6667
6672
  ).length === branchSize ? parentTag.node.name.value : false;
6668
6673
  }
@@ -6696,8 +6701,8 @@ var for_default = {
6696
6701
  isAttrTag ? 4 /* local */ : 5 /* derived */
6697
6702
  );
6698
6703
  let allowAttrs;
6699
- (0, import_babel_utils24.assertNoVar)(tag);
6700
- (0, import_babel_utils24.assertNoArgs)(tag);
6704
+ (0, import_babel_utils25.assertNoVar)(tag);
6705
+ (0, import_babel_utils25.assertNoArgs)(tag);
6701
6706
  assertNoSpreadAttrs(tag);
6702
6707
  const forType = getForType(tag.node);
6703
6708
  switch (forType) {
@@ -6721,7 +6726,7 @@ var for_default = {
6721
6726
  if (!isAttrTag) {
6722
6727
  allowAttrs.push("by");
6723
6728
  }
6724
- (0, import_babel_utils24.assertAllowedAttributes)(tag, allowAttrs);
6729
+ (0, import_babel_utils25.assertAllowedAttributes)(tag, allowAttrs);
6725
6730
  if (isAttrTag) return;
6726
6731
  const bodySection = startSection(tagBody);
6727
6732
  if (!bodySection) {
@@ -7074,11 +7079,11 @@ function translateAttrs(tag, propTree = true, skip2, statements = [], contentKey
7074
7079
  }
7075
7080
  }
7076
7081
  }
7077
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
7082
+ const attrTags2 = getAttrTagPaths(tag);
7078
7083
  for (let i = 0; i < attrTags2.length; i++) {
7079
7084
  const child = attrTags2[i];
7080
7085
  if (child.isMarkoTag()) {
7081
- if ((0, import_babel_utils25.isAttributeTag)(child)) {
7086
+ if ((0, import_babel_utils26.isAttributeTag)(child)) {
7082
7087
  const attrTagMeta = attrTagLookup[getTagName(child)];
7083
7088
  if (skip2?.has(attrTagMeta.name)) continue;
7084
7089
  if (attrTagMeta.dynamic) {
@@ -7178,7 +7183,7 @@ function getTranslatedBodyContentProperty(props) {
7178
7183
  function addDynamicAttrTagStatements(attrTags2, index, attrTagLookup, statements, propTree, contentKey = "content") {
7179
7184
  const tag = attrTags2[index];
7180
7185
  if (tag.isMarkoTag()) {
7181
- if ((0, import_babel_utils25.isAttributeTag)(tag)) {
7186
+ if ((0, import_babel_utils26.isAttributeTag)(tag)) {
7182
7187
  const attrTagMeta = attrTagLookup[getTagName(tag)];
7183
7188
  const attrTagExport = getKnownFromPropTree(propTree, attrTagMeta.name);
7184
7189
  if (attrTagExport && attrTagMeta.dynamic) {
@@ -7317,7 +7322,7 @@ function translateIfAttrTag(attrTags2, index, attrTagLookup, statements, propTre
7317
7322
  return nextIndex - 1;
7318
7323
  }
7319
7324
  function addAllAttrTagsAsDynamic(tag, attrTagLookup, statements, propTree, contentKey) {
7320
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
7325
+ const attrTags2 = getAttrTagPaths(tag);
7321
7326
  for (let i = 0; i < attrTags2.length; i++) {
7322
7327
  i = addDynamicAttrTagStatements(
7323
7328
  attrTags2,
@@ -7802,10 +7807,10 @@ function analyzeAttrs(rootTagExtra, section, tag, propTree, rootAttrExprs) {
7802
7807
  for (const attrTagName in attrTagLookup) {
7803
7808
  seen.add(attrTagLookup[attrTagName].name);
7804
7809
  }
7805
- const attrTags2 = tag.node.body.attributeTags ? tag.get("body").get("body") : tag.get("attributeTags");
7810
+ const attrTags2 = getAttrTagPaths(tag);
7806
7811
  for (const child of attrTags2) {
7807
7812
  if (child.isMarkoTag()) {
7808
- if ((0, import_babel_utils26.isAttributeTag)(child)) {
7813
+ if ((0, import_babel_utils27.isAttributeTag)(child)) {
7809
7814
  const attrTagMeta = attrTagLookup[getTagName(child)];
7810
7815
  const childAttrExport = getKnownFromPropTree(
7811
7816
  propTree,
@@ -8083,7 +8088,7 @@ function applyAttrObject(tag, propTree, tagInputIdentifier, info) {
8083
8088
  translatedAttrs.statements
8084
8089
  );
8085
8090
  }
8086
- if ((0, import_babel_utils26.isAttributeTag)(tag)) {
8091
+ if ((0, import_babel_utils27.isAttributeTag)(tag)) {
8087
8092
  const attrTagName = getTagName(tag);
8088
8093
  const parentTag = tag.parentPath;
8089
8094
  const repeated = analyzeAttributeTags(parentTag)?.[attrTagName]?.repeated;
@@ -8203,7 +8208,7 @@ function writeAttrsToSignals(tag, propTree, importAlias, info) {
8203
8208
  for (let i = 0; i < attrTags2.length; i++) {
8204
8209
  const child = attrTags2[i];
8205
8210
  if (child.isMarkoTag()) {
8206
- if ((0, import_babel_utils26.isAttributeTag)(child)) {
8211
+ if ((0, import_babel_utils27.isAttributeTag)(child)) {
8207
8212
  const attrTagMeta = attrTagLookup[getTagName(child)];
8208
8213
  const childAttrExport = getKnownFromPropTree(
8209
8214
  propTree,
@@ -9322,12 +9327,14 @@ function finalizeReferences() {
9322
9327
  closure,
9323
9328
  getAccessorPrefix().ClosureScopes
9324
9329
  );
9325
- addSerializeReason(
9326
- section,
9327
- closure.sources,
9328
- closure,
9329
- getAccessorPrefix().ClosureSignalIndex
9330
- );
9330
+ if (getDynamicClosureIndex(closure, section)) {
9331
+ addSerializeReason(
9332
+ section,
9333
+ closure.sources,
9334
+ closure,
9335
+ getAccessorPrefix().ClosureSignalIndex
9336
+ );
9337
+ }
9331
9338
  }
9332
9339
  }
9333
9340
  });
@@ -9398,7 +9405,7 @@ function finalizeReferences() {
9398
9405
  });
9399
9406
  }
9400
9407
  });
9401
- const programSection = (0, import_babel_utils27.getProgram)().node.extra.section;
9408
+ const programSection = (0, import_babel_utils28.getProgram)().node.extra.section;
9402
9409
  if (programSection.returnValueExpr) {
9403
9410
  programSection.returnSerializeReason = getSerializeSourcesForExpr(
9404
9411
  programSection.returnValueExpr
@@ -10139,7 +10146,7 @@ function getAllSerializeReasonsForExtra(extra) {
10139
10146
  let reason = serializeReasonCache.get(extra);
10140
10147
  if (reason === false) return;
10141
10148
  if (reason === void 0) {
10142
- if (extra === (0, import_babel_utils27.getProgram)().node.extra?.section.returnValueExpr) {
10149
+ if (extra === (0, import_babel_utils28.getProgram)().node.extra?.section.returnValueExpr) {
10143
10150
  reason = true;
10144
10151
  } else {
10145
10152
  serializeReasonCache.set(extra, false);
@@ -10263,10 +10270,10 @@ function setReadsOwner(from, to) {
10263
10270
  var kDOMBinding = /* @__PURE__ */ Symbol("await tag dom binding");
10264
10271
  var await_default = {
10265
10272
  analyze(tag) {
10266
- (0, import_babel_utils28.assertNoVar)(tag);
10267
- (0, import_babel_utils28.assertNoArgs)(tag);
10273
+ (0, import_babel_utils29.assertNoVar)(tag);
10274
+ (0, import_babel_utils29.assertNoArgs)(tag);
10268
10275
  assertNoSpreadAttrs(tag);
10269
- (0, import_babel_utils28.assertNoAttributeTags)(tag);
10276
+ (0, import_babel_utils29.assertNoAttributeTags)(tag);
10270
10277
  const { node } = tag;
10271
10278
  const tagBody = tag.get("body");
10272
10279
  const section = getOrCreateSection(tag);
@@ -10295,7 +10302,6 @@ var await_default = {
10295
10302
  }
10296
10303
  const bodySection = startSection(tagBody);
10297
10304
  const valueExtra = evaluate(valueAttr.value);
10298
- getOrCreateSection(tag);
10299
10305
  const paramsBinding = trackParamsReferences(tagBody, 5 /* derived */);
10300
10306
  if (paramsBinding) {
10301
10307
  setBindingDownstream(paramsBinding, valueExtra);
@@ -10403,7 +10409,7 @@ var await_default = {
10403
10409
  attributes: {},
10404
10410
  autocomplete: [
10405
10411
  {
10406
- description: "Use to consume asynchronous an data.",
10412
+ description: "Use to consume asynchronous data.",
10407
10413
  descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#await"
10408
10414
  }
10409
10415
  ],
@@ -10412,7 +10418,7 @@ var await_default = {
10412
10418
 
10413
10419
  // src/translator/core/client.ts
10414
10420
  var import_compiler40 = require("@marko/compiler");
10415
- var import_babel_utils29 = require("@marko/compiler/babel-utils");
10421
+ var import_babel_utils30 = require("@marko/compiler/babel-utils");
10416
10422
  var client_default = {
10417
10423
  parse(tag) {
10418
10424
  const {
@@ -10422,7 +10428,7 @@ var client_default = {
10422
10428
  const rawValue = node.rawValue;
10423
10429
  const code = rawValue.replace(/^client\s*/, "");
10424
10430
  const start = node.start + (rawValue.length - code.length);
10425
- let body = (0, import_babel_utils29.parseStatements)(file, code, start, start + code.length);
10431
+ let body = (0, import_babel_utils30.parseStatements)(file, code, start, start + code.length);
10426
10432
  if (body.length === 1 && import_compiler40.types.isBlockStatement(body[0])) {
10427
10433
  body = body[0].body;
10428
10434
  }
@@ -10443,11 +10449,11 @@ var client_default = {
10443
10449
 
10444
10450
  // src/translator/core/const.ts
10445
10451
  var import_compiler41 = require("@marko/compiler");
10446
- var import_babel_utils30 = require("@marko/compiler/babel-utils");
10452
+ var import_babel_utils31 = require("@marko/compiler/babel-utils");
10447
10453
  var const_default = {
10448
10454
  analyze(tag) {
10449
- (0, import_babel_utils30.assertNoArgs)(tag);
10450
- (0, import_babel_utils30.assertNoParams)(tag);
10455
+ (0, import_babel_utils31.assertNoArgs)(tag);
10456
+ (0, import_babel_utils31.assertNoParams)(tag);
10451
10457
  assertNoBodyContent(tag);
10452
10458
  const { node } = tag;
10453
10459
  const [valueAttr] = node.attributes;
@@ -10515,7 +10521,7 @@ var const_default = {
10515
10521
  attributes: {},
10516
10522
  autocomplete: [
10517
10523
  {
10518
- description: "Use to create an constant binding.",
10524
+ description: "Use to create a constant binding.",
10519
10525
  descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#const"
10520
10526
  }
10521
10527
  ],
@@ -10524,13 +10530,13 @@ var const_default = {
10524
10530
 
10525
10531
  // src/translator/core/debug.ts
10526
10532
  var import_compiler42 = require("@marko/compiler");
10527
- var import_babel_utils31 = require("@marko/compiler/babel-utils");
10533
+ var import_babel_utils32 = require("@marko/compiler/babel-utils");
10528
10534
  var debug_default = {
10529
10535
  analyze(tag) {
10530
10536
  const [valueAttr] = tag.node.attributes;
10531
- (0, import_babel_utils31.assertNoVar)(tag);
10532
- (0, import_babel_utils31.assertNoArgs)(tag);
10533
- (0, import_babel_utils31.assertNoParams)(tag);
10537
+ (0, import_babel_utils32.assertNoVar)(tag);
10538
+ (0, import_babel_utils32.assertNoArgs)(tag);
10539
+ (0, import_babel_utils32.assertNoParams)(tag);
10534
10540
  assertNoBodyContent(tag);
10535
10541
  if (tag.node.attributes.length > 1 || tag.node.attributes.length === 1 && (!import_compiler42.types.isMarkoAttribute(valueAttr) || !valueAttr.default && valueAttr.name !== "value")) {
10536
10542
  throw tag.get("name").buildCodeFrameError(
@@ -10567,10 +10573,10 @@ var debug_default = {
10567
10573
 
10568
10574
  // src/translator/core/define.ts
10569
10575
  var import_compiler43 = require("@marko/compiler");
10570
- var import_babel_utils32 = require("@marko/compiler/babel-utils");
10576
+ var import_babel_utils33 = require("@marko/compiler/babel-utils");
10571
10577
  var define_default = {
10572
10578
  analyze(tag) {
10573
- (0, import_babel_utils32.assertNoArgs)(tag);
10579
+ (0, import_babel_utils33.assertNoArgs)(tag);
10574
10580
  if (!tag.node.var) {
10575
10581
  throw tag.get("name").buildCodeFrameError(
10576
10582
  "The [`<define>` tag](https://markojs.com/docs/reference/core-tag#define) requires a [tag variable](https://markojs.com/docs/reference/language#tag-variables)."
@@ -10701,17 +10707,17 @@ var define_default = {
10701
10707
 
10702
10708
  // src/translator/core/effect.ts
10703
10709
  var import_compiler44 = require("@marko/compiler");
10704
- var import_babel_utils33 = require("@marko/compiler/babel-utils");
10710
+ var import_babel_utils34 = require("@marko/compiler/babel-utils");
10705
10711
  var effect_default = {
10706
10712
  migrate: [
10707
10713
  (tag) => {
10708
- (0, import_babel_utils33.assertNoArgs)(tag);
10709
- (0, import_babel_utils33.assertNoParams)(tag);
10714
+ (0, import_babel_utils34.assertNoArgs)(tag);
10715
+ (0, import_babel_utils34.assertNoParams)(tag);
10710
10716
  assertNoBodyContent(tag);
10711
- (0, import_babel_utils33.assertNoAttributeTags)(tag);
10717
+ (0, import_babel_utils34.assertNoAttributeTags)(tag);
10712
10718
  assertNoSpreadAttrs(tag);
10713
- (0, import_babel_utils33.assertAllowedAttributes)(tag, ["value"]);
10714
- (0, import_babel_utils33.diagnosticDeprecate)(tag, {
10719
+ (0, import_babel_utils34.assertAllowedAttributes)(tag, ["value"]);
10720
+ (0, import_babel_utils34.diagnosticDeprecate)(tag, {
10715
10721
  label: "The 'effect' tag has been replaced by the 'script' tag.",
10716
10722
  fix() {
10717
10723
  const { node } = tag;
@@ -10734,12 +10740,12 @@ var effect_default = {
10734
10740
  };
10735
10741
 
10736
10742
  // src/translator/core/export.ts
10737
- var import_babel_utils34 = require("@marko/compiler/babel-utils");
10743
+ var import_babel_utils35 = require("@marko/compiler/babel-utils");
10738
10744
  var export_default = {
10739
10745
  parse(tag) {
10740
10746
  const { node } = tag;
10741
10747
  tag.replaceWith(
10742
- (0, import_babel_utils34.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
10748
+ (0, import_babel_utils35.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
10743
10749
  );
10744
10750
  },
10745
10751
  parseOptions: {
@@ -10755,13 +10761,13 @@ var export_default = {
10755
10761
 
10756
10762
  // src/translator/core/html-comment.ts
10757
10763
  var import_compiler45 = require("@marko/compiler");
10758
- var import_babel_utils35 = require("@marko/compiler/babel-utils");
10764
+ var import_babel_utils36 = require("@marko/compiler/babel-utils");
10759
10765
  var kNodeBinding = /* @__PURE__ */ Symbol("comment tag binding");
10760
10766
  var html_comment_default = {
10761
10767
  analyze(tag) {
10762
- (0, import_babel_utils35.assertNoArgs)(tag);
10763
- (0, import_babel_utils35.assertNoParams)(tag);
10764
- (0, import_babel_utils35.assertNoAttributes)(tag);
10768
+ (0, import_babel_utils36.assertNoArgs)(tag);
10769
+ (0, import_babel_utils36.assertNoParams)(tag);
10770
+ (0, import_babel_utils36.assertNoAttributes)(tag);
10765
10771
  const tagVar = tag.node.var;
10766
10772
  let needsBinding = false;
10767
10773
  if (tagVar) {
@@ -10831,7 +10837,7 @@ var html_comment_default = {
10831
10837
  } else {
10832
10838
  addStatement(
10833
10839
  "render",
10834
- getSection(tag),
10840
+ tagSection,
10835
10841
  tagExtra.referencedBindings,
10836
10842
  import_compiler45.types.expressionStatement(
10837
10843
  callRuntime(
@@ -10901,13 +10907,13 @@ var html_style_default = {
10901
10907
 
10902
10908
  // src/translator/core/id.ts
10903
10909
  var import_compiler46 = require("@marko/compiler");
10904
- var import_babel_utils36 = require("@marko/compiler/babel-utils");
10910
+ var import_babel_utils37 = require("@marko/compiler/babel-utils");
10905
10911
  var id_default = {
10906
10912
  analyze(tag) {
10907
- (0, import_babel_utils36.assertNoArgs)(tag);
10908
- (0, import_babel_utils36.assertNoParams)(tag);
10913
+ (0, import_babel_utils37.assertNoArgs)(tag);
10914
+ (0, import_babel_utils37.assertNoParams)(tag);
10909
10915
  assertNoBodyContent(tag);
10910
- (0, import_babel_utils36.assertNoAttributeTags)(tag);
10916
+ (0, import_babel_utils37.assertNoAttributeTags)(tag);
10911
10917
  const { node } = tag;
10912
10918
  const [valueAttr] = node.attributes;
10913
10919
  if (!node.var) {
@@ -10979,7 +10985,7 @@ var id_default = {
10979
10985
 
10980
10986
  // src/translator/core/if.ts
10981
10987
  var import_compiler48 = require("@marko/compiler");
10982
- var import_babel_utils37 = require("@marko/compiler/babel-utils");
10988
+ var import_babel_utils38 = require("@marko/compiler/babel-utils");
10983
10989
 
10984
10990
  // src/translator/util/to-first-statement-or-block.ts
10985
10991
  var import_compiler47 = require("@marko/compiler");
@@ -11247,9 +11253,9 @@ var ElseTag = {
11247
11253
  ]
11248
11254
  };
11249
11255
  function assertValidCondition(tag) {
11250
- (0, import_babel_utils37.assertNoVar)(tag);
11251
- (0, import_babel_utils37.assertNoArgs)(tag);
11252
- (0, import_babel_utils37.assertNoParams)(tag);
11256
+ (0, import_babel_utils38.assertNoVar)(tag);
11257
+ (0, import_babel_utils38.assertNoArgs)(tag);
11258
+ (0, import_babel_utils38.assertNoParams)(tag);
11253
11259
  assertHasBody(tag);
11254
11260
  assertNoSpreadAttrs(tag);
11255
11261
  switch (getTagName(tag)) {
@@ -11348,12 +11354,12 @@ function isRoot(tag) {
11348
11354
  }
11349
11355
 
11350
11356
  // src/translator/core/import.ts
11351
- var import_babel_utils38 = require("@marko/compiler/babel-utils");
11357
+ var import_babel_utils39 = require("@marko/compiler/babel-utils");
11352
11358
  var import_default = {
11353
11359
  parse(tag) {
11354
11360
  const { node } = tag;
11355
11361
  tag.replaceWith(
11356
- (0, import_babel_utils38.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
11362
+ (0, import_babel_utils39.parseStatements)(tag.hub.file, node.rawValue, node.start, node.end)[0]
11357
11363
  );
11358
11364
  },
11359
11365
  parseOptions: {
@@ -11372,7 +11378,7 @@ var import_default = {
11372
11378
 
11373
11379
  // src/translator/core/let.ts
11374
11380
  var import_compiler49 = require("@marko/compiler");
11375
- var import_babel_utils39 = require("@marko/compiler/babel-utils");
11381
+ var import_babel_utils40 = require("@marko/compiler/babel-utils");
11376
11382
  var let_default = {
11377
11383
  analyze(tag) {
11378
11384
  const { node } = tag;
@@ -11401,8 +11407,8 @@ var let_default = {
11401
11407
  }
11402
11408
  }
11403
11409
  }
11404
- (0, import_babel_utils39.assertNoArgs)(tag);
11405
- (0, import_babel_utils39.assertNoParams)(tag);
11410
+ (0, import_babel_utils40.assertNoArgs)(tag);
11411
+ (0, import_babel_utils40.assertNoParams)(tag);
11406
11412
  assertNoBodyContent(tag);
11407
11413
  assertNoSpreadAttrs(tag);
11408
11414
  if (!tagVar) {
@@ -11415,7 +11421,7 @@ var let_default = {
11415
11421
  "The [`<let>` tag](https://markojs.com/docs/reference/core-tag#let) variable cannot be destructured."
11416
11422
  );
11417
11423
  }
11418
- if (valueChangeAttr && (0, import_babel_utils39.computeNode)(valueChangeAttr.value)?.value) {
11424
+ if (valueChangeAttr && (0, import_babel_utils40.computeNode)(valueChangeAttr.value)?.value) {
11419
11425
  throw tag.get("attributes").find((attr) => attr.node === valueChangeAttr).get("value").buildCodeFrameError(
11420
11426
  "The [`<let>` tag](https://markojs.com/docs/reference/core-tag#let) [`valueChange=` attribute](https://markojs.com/docs/reference/core-tag#controllable-let) must be a function."
11421
11427
  );
@@ -11498,13 +11504,13 @@ var let_default = {
11498
11504
 
11499
11505
  // src/translator/core/lifecycle.ts
11500
11506
  var import_compiler50 = require("@marko/compiler");
11501
- var import_babel_utils40 = require("@marko/compiler/babel-utils");
11507
+ var import_babel_utils41 = require("@marko/compiler/babel-utils");
11502
11508
  var [getIndex, setIndex] = createSectionState("lifecycleIndex", () => 0);
11503
11509
  var lifecycle_default = {
11504
11510
  analyze(tag) {
11505
- (0, import_babel_utils40.assertNoArgs)(tag);
11506
- (0, import_babel_utils40.assertNoVar)(tag);
11507
- (0, import_babel_utils40.assertNoParams)(tag);
11511
+ (0, import_babel_utils41.assertNoArgs)(tag);
11512
+ (0, import_babel_utils41.assertNoVar)(tag);
11513
+ (0, import_babel_utils41.assertNoParams)(tag);
11508
11514
  assertNoBodyContent(tag);
11509
11515
  const { node } = tag;
11510
11516
  const section = getOrCreateSection(tag);
@@ -11526,7 +11532,7 @@ var lifecycle_default = {
11526
11532
  );
11527
11533
  }
11528
11534
  }
11529
- (0, import_babel_utils40.getProgram)().node.extra.isInteractive = true;
11535
+ (0, import_babel_utils41.getProgram)().node.extra.isInteractive = true;
11530
11536
  },
11531
11537
  translate: {
11532
11538
  exit(tag) {
@@ -11566,7 +11572,7 @@ var lifecycle_default = {
11566
11572
  attributes: {},
11567
11573
  autocomplete: [
11568
11574
  {
11569
- description: "Use to create a side effects.",
11575
+ description: "Use to create side effects.",
11570
11576
  descriptionMoreURL: "https://markojs.com/docs/reference/core-tag#lifecycle"
11571
11577
  }
11572
11578
  ],
@@ -11575,13 +11581,13 @@ var lifecycle_default = {
11575
11581
 
11576
11582
  // src/translator/core/log.ts
11577
11583
  var import_compiler51 = require("@marko/compiler");
11578
- var import_babel_utils41 = require("@marko/compiler/babel-utils");
11584
+ var import_babel_utils42 = require("@marko/compiler/babel-utils");
11579
11585
  var log_default = {
11580
11586
  analyze(tag) {
11581
11587
  const [valueAttr] = tag.node.attributes;
11582
- (0, import_babel_utils41.assertNoArgs)(tag);
11583
- (0, import_babel_utils41.assertNoVar)(tag);
11584
- (0, import_babel_utils41.assertNoParams)(tag);
11588
+ (0, import_babel_utils42.assertNoArgs)(tag);
11589
+ (0, import_babel_utils42.assertNoVar)(tag);
11590
+ (0, import_babel_utils42.assertNoParams)(tag);
11585
11591
  assertNoBodyContent(tag);
11586
11592
  if (!valueAttr) {
11587
11593
  throw tag.get("name").buildCodeFrameError(
@@ -11629,7 +11635,7 @@ var log_default = {
11629
11635
 
11630
11636
  // src/translator/core/script.ts
11631
11637
  var import_compiler52 = require("@marko/compiler");
11632
- var import_babel_utils42 = require("@marko/compiler/babel-utils");
11638
+ var import_babel_utils43 = require("@marko/compiler/babel-utils");
11633
11639
  var htmlScriptTagAlternateMsg = " For a native html [`<script>` tag](https://markojs.com/docs/reference/core-tag#script) use the `html-script` core tag instead.";
11634
11640
  var script_default = {
11635
11641
  parse(tag) {
@@ -11649,7 +11655,7 @@ var script_default = {
11649
11655
  }
11650
11656
  const start = body[0]?.start;
11651
11657
  const end = body[body.length - 1]?.end;
11652
- const bodyStatements = (0, import_babel_utils42.parseStatements)(tag.hub.file, code, start, end);
11658
+ const bodyStatements = (0, import_babel_utils43.parseStatements)(tag.hub.file, code, start, end);
11653
11659
  if (bodyStatements.length) {
11654
11660
  const valueFn = import_compiler52.types.arrowFunctionExpression(
11655
11661
  [],
@@ -11663,10 +11669,10 @@ var script_default = {
11663
11669
  },
11664
11670
  analyze(tag) {
11665
11671
  const { node } = tag;
11666
- (0, import_babel_utils42.assertNoArgs)(tag);
11667
- (0, import_babel_utils42.assertNoParams)(tag);
11672
+ (0, import_babel_utils43.assertNoArgs)(tag);
11673
+ (0, import_babel_utils43.assertNoParams)(tag);
11668
11674
  assertNoBodyContent(tag);
11669
- (0, import_babel_utils42.assertNoAttributeTags)(tag);
11675
+ (0, import_babel_utils43.assertNoAttributeTags)(tag);
11670
11676
  if (node.var) {
11671
11677
  throw tag.hub.buildError(
11672
11678
  node.var,
@@ -11681,7 +11687,7 @@ var script_default = {
11681
11687
  }
11682
11688
  seenValueAttr = true;
11683
11689
  (attr.value.extra ??= {}).isEffect = true;
11684
- (0, import_babel_utils42.getProgram)().node.extra.isInteractive = true;
11690
+ (0, import_babel_utils43.getProgram)().node.extra.isInteractive = true;
11685
11691
  } else {
11686
11692
  throw tag.hub.buildError(
11687
11693
  attr,
@@ -11745,7 +11751,7 @@ var script_default = {
11745
11751
  },
11746
11752
  autocomplete: [
11747
11753
  {
11748
- description: "Use to create a side effects.",
11754
+ description: "Use to create side effects.",
11749
11755
  descriptionMoreURL: "https://markojs.com/docs/core-tags/#script"
11750
11756
  }
11751
11757
  ],
@@ -11771,7 +11777,7 @@ function isAwaitExpression(node) {
11771
11777
 
11772
11778
  // src/translator/core/server.ts
11773
11779
  var import_compiler53 = require("@marko/compiler");
11774
- var import_babel_utils43 = require("@marko/compiler/babel-utils");
11780
+ var import_babel_utils44 = require("@marko/compiler/babel-utils");
11775
11781
  var server_default = {
11776
11782
  parse(tag) {
11777
11783
  const {
@@ -11781,7 +11787,7 @@ var server_default = {
11781
11787
  const rawValue = node.rawValue;
11782
11788
  const code = rawValue.replace(/^server\s*/, "");
11783
11789
  const start = node.start + (rawValue.length - code.length);
11784
- let body = (0, import_babel_utils43.parseStatements)(file, code, start, start + code.length);
11790
+ let body = (0, import_babel_utils44.parseStatements)(file, code, start, start + code.length);
11785
11791
  if (body.length === 1 && import_compiler53.types.isBlockStatement(body[0])) {
11786
11792
  body = body[0].body;
11787
11793
  }
@@ -11802,7 +11808,7 @@ var server_default = {
11802
11808
 
11803
11809
  // src/translator/core/static.ts
11804
11810
  var import_compiler54 = require("@marko/compiler");
11805
- var import_babel_utils44 = require("@marko/compiler/babel-utils");
11811
+ var import_babel_utils45 = require("@marko/compiler/babel-utils");
11806
11812
  var static_default = {
11807
11813
  parse(tag) {
11808
11814
  const {
@@ -11812,7 +11818,7 @@ var static_default = {
11812
11818
  const rawValue = node.rawValue;
11813
11819
  const code = rawValue.replace(/^static\s*/, "");
11814
11820
  const start = node.start + (rawValue.length - code.length);
11815
- let body = (0, import_babel_utils44.parseStatements)(file, code, start, start + code.length);
11821
+ let body = (0, import_babel_utils45.parseStatements)(file, code, start, start + code.length);
11816
11822
  if (body.length === 1 && import_compiler54.types.isBlockStatement(body[0])) {
11817
11823
  body = body[0].body;
11818
11824
  }
@@ -11833,16 +11839,16 @@ var static_default = {
11833
11839
 
11834
11840
  // src/translator/core/style.ts
11835
11841
  var import_compiler55 = require("@marko/compiler");
11836
- var import_babel_utils45 = require("@marko/compiler/babel-utils");
11842
+ var import_babel_utils46 = require("@marko/compiler/babel-utils");
11837
11843
  var import_magic_string = __toESM(require("magic-string"));
11838
11844
  var import_path3 = __toESM(require("path"));
11839
11845
  var STYLE_EXT_REG = /^style((?:\.[a-zA-Z0-9$_-]+)+)?/;
11840
11846
  var htmlStyleTagAlternateMsg = " For a native html [`<style>` tag](https://markojs.com/docs/reference/core-tag#style) use the `html-style` core tag instead.";
11841
11847
  var style_default = {
11842
11848
  analyze(tag) {
11843
- (0, import_babel_utils45.assertNoArgs)(tag);
11844
- (0, import_babel_utils45.assertNoParams)(tag);
11845
- (0, import_babel_utils45.assertNoAttributeTags)(tag);
11849
+ (0, import_babel_utils46.assertNoArgs)(tag);
11850
+ (0, import_babel_utils46.assertNoParams)(tag);
11851
+ (0, import_babel_utils46.assertNoAttributeTags)(tag);
11846
11852
  const { node } = tag;
11847
11853
  const ext = STYLE_EXT_REG.exec(node.rawValue || "")?.[1]?.slice(1);
11848
11854
  for (const attr of node.attributes) {
@@ -11882,13 +11888,13 @@ var style_default = {
11882
11888
  for (const child of node.body.body) {
11883
11889
  code += child.value;
11884
11890
  if (createMap) {
11885
- const start = (0, import_babel_utils45.getStart)(file, child);
11891
+ const start = (0, import_babel_utils46.getStart)(file, child);
11886
11892
  if (start !== null) {
11887
11893
  magicString ||= new import_magic_string.default(file.code, { filename });
11888
11894
  if (start > last) {
11889
11895
  magicString.remove(last, start);
11890
11896
  }
11891
- last = (0, import_babel_utils45.getEnd)(file, child);
11897
+ last = (0, import_babel_utils46.getEnd)(file, child);
11892
11898
  }
11893
11899
  }
11894
11900
  }
@@ -11915,11 +11921,11 @@ var style_default = {
11915
11921
  });
11916
11922
  if (importPath) {
11917
11923
  if (!node.var) {
11918
- (0, import_babel_utils45.getProgram)().node.body.push(
11924
+ (0, import_babel_utils46.getProgram)().node.body.push(
11919
11925
  import_compiler55.types.importDeclaration([], import_compiler55.types.stringLiteral(importPath))
11920
11926
  );
11921
11927
  } else if (import_compiler55.types.isIdentifier(node.var)) {
11922
- (0, import_babel_utils45.getProgram)().node.body.push(
11928
+ (0, import_babel_utils46.getProgram)().node.body.push(
11923
11929
  import_compiler55.types.importDeclaration(
11924
11930
  [import_compiler55.types.importNamespaceSpecifier(node.var)],
11925
11931
  import_compiler55.types.stringLiteral(importPath)
@@ -11927,9 +11933,9 @@ var style_default = {
11927
11933
  );
11928
11934
  } else {
11929
11935
  const varDecl = import_compiler55.types.variableDeclaration("const", [
11930
- import_compiler55.types.variableDeclarator(node.var, (0, import_babel_utils45.importStar)(file, importPath, "style"))
11936
+ import_compiler55.types.variableDeclarator(node.var, (0, import_babel_utils46.importStar)(file, importPath, "style"))
11931
11937
  ]);
11932
- (0, import_babel_utils45.getProgram)().node.body.push(
11938
+ (0, import_babel_utils46.getProgram)().node.body.push(
11933
11939
  isOutputDOM() ? varDecl : import_compiler55.types.markoScriptlet([varDecl], true)
11934
11940
  );
11935
11941
  }
@@ -11947,16 +11953,15 @@ var style_default = {
11947
11953
 
11948
11954
  // src/translator/core/try.ts
11949
11955
  var import_compiler56 = require("@marko/compiler");
11950
- var import_babel_utils46 = require("@marko/compiler/babel-utils");
11956
+ var import_babel_utils47 = require("@marko/compiler/babel-utils");
11951
11957
  var hasEnabledCatch = /* @__PURE__ */ new WeakSet();
11952
11958
  var kDOMBinding2 = /* @__PURE__ */ Symbol("try tag dom binding");
11953
11959
  var try_default = {
11954
11960
  analyze(tag) {
11955
- (0, import_babel_utils46.assertNoVar)(tag);
11956
- (0, import_babel_utils46.assertNoArgs)(tag);
11957
- (0, import_babel_utils46.assertNoParams)(tag);
11958
- (0, import_babel_utils46.assertNoAttributes)(tag);
11959
- assertNoSpreadAttrs(tag);
11961
+ (0, import_babel_utils47.assertNoVar)(tag);
11962
+ (0, import_babel_utils47.assertNoArgs)(tag);
11963
+ (0, import_babel_utils47.assertNoParams)(tag);
11964
+ (0, import_babel_utils47.assertNoAttributes)(tag);
11960
11965
  analyzeAttributeTags(tag);
11961
11966
  const section = getOrCreateSection(tag);
11962
11967
  const tagExtra = mergeReferences(
@@ -12068,7 +12073,7 @@ var try_default = {
12068
12073
  translatedAttrs.statements
12069
12074
  );
12070
12075
  }
12071
- const program = (0, import_babel_utils46.getProgram)().node;
12076
+ const program = (0, import_babel_utils47.getProgram)().node;
12072
12077
  if (!hasEnabledCatch.has(program)) {
12073
12078
  hasEnabledCatch.add(program);
12074
12079
  program.body.push(
@@ -12170,13 +12175,13 @@ var document_type_default = {
12170
12175
  };
12171
12176
 
12172
12177
  // src/translator/visitors/import-declaration.ts
12173
- var import_babel_utils47 = require("@marko/compiler/babel-utils");
12178
+ var import_babel_utils48 = require("@marko/compiler/babel-utils");
12174
12179
  var import_declaration_default = {
12175
12180
  analyze(importDecl) {
12176
12181
  const { node } = importDecl;
12177
12182
  const { source } = node;
12178
12183
  const { value } = source;
12179
- const tagImport = (0, import_babel_utils47.resolveTagImport)(importDecl, value);
12184
+ const tagImport = (0, import_babel_utils48.resolveTagImport)(importDecl, value);
12180
12185
  if (tagImport) {
12181
12186
  node.extra ??= {};
12182
12187
  node.extra.tagImport = tagImport;
@@ -12211,7 +12216,7 @@ var placeholder_default = {
12211
12216
  const { node } = placeholder;
12212
12217
  const valueExtra = evaluate(node.value);
12213
12218
  const { confident, computed } = valueExtra;
12214
- if (confident && isVoid2(computed)) return;
12219
+ if (confident && isVoid(computed)) return;
12215
12220
  if (isStaticText(node)) {
12216
12221
  if (isStaticText(getPrev(placeholder)) || isStaticText(getNext(placeholder))) {
12217
12222
  (node.extra ??= {})[kSharedText] = true;
@@ -12234,7 +12239,7 @@ var placeholder_default = {
12234
12239
  const { value } = node;
12235
12240
  const valueExtra = evaluate(value);
12236
12241
  const { confident, computed } = valueExtra;
12237
- if (confident && isVoid2(computed)) {
12242
+ if (confident && isVoid(computed)) {
12238
12243
  placeholder.remove();
12239
12244
  return;
12240
12245
  }
@@ -12273,7 +12278,7 @@ var placeholder_default = {
12273
12278
  } else {
12274
12279
  addStatement(
12275
12280
  "render",
12276
- getSection(placeholder),
12281
+ section,
12277
12282
  valueExtra.referencedBindings,
12278
12283
  import_compiler57.types.expressionStatement(
12279
12284
  method === "_text" ? callRuntime(
@@ -12337,9 +12342,6 @@ function analyzeSiblingText(placeholder) {
12337
12342
  }
12338
12343
  return placeholderExtra[kSiblingText] = 0 /* None */;
12339
12344
  }
12340
- function isVoid2(value) {
12341
- return value == null || value === false;
12342
- }
12343
12345
  function isStaticText(node) {
12344
12346
  switch (node?.type) {
12345
12347
  case "MarkoText":
@@ -12347,7 +12349,7 @@ function isStaticText(node) {
12347
12349
  case "MarkoPlaceholder": {
12348
12350
  if (node.escape) {
12349
12351
  const { confident, computed } = evaluate(node.value);
12350
- return confident && !isVoid2(computed);
12352
+ return confident && !isVoid(computed);
12351
12353
  } else {
12352
12354
  return false;
12353
12355
  }
@@ -12370,7 +12372,7 @@ function getNext(path7) {
12370
12372
  }
12371
12373
  function isEmptyPlaceholder(placeholder) {
12372
12374
  const { confident, computed } = evaluate(placeholder.value);
12373
- return confident && isVoid2(computed);
12375
+ return confident && isVoid(computed);
12374
12376
  }
12375
12377
 
12376
12378
  // src/translator/visitors/referenced-identifier.ts
@@ -12478,7 +12480,7 @@ var referenced_identifier_default = {
12478
12480
 
12479
12481
  // src/translator/visitors/scriptlet.ts
12480
12482
  var import_compiler59 = require("@marko/compiler");
12481
- var import_babel_utils48 = require("@marko/compiler/babel-utils");
12483
+ var import_babel_utils49 = require("@marko/compiler/babel-utils");
12482
12484
  var scriptlet_default = {
12483
12485
  analyze(scriptlet) {
12484
12486
  if (!scriptlet.node.static) {
@@ -12492,7 +12494,7 @@ var scriptlet_default = {
12492
12494
  scriptlet.node.body
12493
12495
  );
12494
12496
  if (scriptlet.node.target === "client") {
12495
- (0, import_babel_utils48.getProgram)().node.extra.isInteractive = true;
12497
+ (0, import_babel_utils49.getProgram)().node.extra.isInteractive = true;
12496
12498
  }
12497
12499
  },
12498
12500
  translate: {
@@ -12528,20 +12530,20 @@ var scriptlet_default = {
12528
12530
 
12529
12531
  // src/translator/visitors/tag/index.ts
12530
12532
  var import_compiler63 = require("@marko/compiler");
12531
- var import_babel_utils52 = require("@marko/compiler/babel-utils");
12533
+ var import_babel_utils53 = require("@marko/compiler/babel-utils");
12532
12534
 
12533
12535
  // src/translator/visitors/tag/attribute-tag.ts
12534
12536
  var import_compiler60 = require("@marko/compiler");
12535
- var import_babel_utils49 = require("@marko/compiler/babel-utils");
12537
+ var import_babel_utils50 = require("@marko/compiler/babel-utils");
12536
12538
  var attribute_tag_default = {
12537
12539
  analyze: {
12538
12540
  enter(tag) {
12539
- (0, import_babel_utils49.assertNoVar)(tag);
12540
- (0, import_babel_utils49.assertNoArgs)(tag);
12541
+ (0, import_babel_utils50.assertNoVar)(tag);
12542
+ (0, import_babel_utils50.assertNoArgs)(tag);
12541
12543
  const body = tag.get("body");
12542
12544
  startSection(body);
12543
12545
  trackParamsReferences(body, 3 /* param */);
12544
- if (!(0, import_babel_utils49.findParentTag)(tag)) {
12546
+ if (!(0, import_babel_utils50.findParentTag)(tag)) {
12545
12547
  throw tag.get("name").buildCodeFrameError(
12546
12548
  "[Attribute tags](https://markojs.com/docs/reference/language#attribute-tags) must be nested within another tag."
12547
12549
  );
@@ -12565,20 +12567,20 @@ var attribute_tag_default = {
12565
12567
 
12566
12568
  // src/translator/visitors/tag/custom-tag.ts
12567
12569
  var import_compiler61 = require("@marko/compiler");
12568
- var import_babel_utils50 = require("@marko/compiler/babel-utils");
12570
+ var import_babel_utils51 = require("@marko/compiler/babel-utils");
12569
12571
  var import_fastest_levenshtein = require("fastest-levenshtein");
12570
12572
  var import_path4 = __toESM(require("path"));
12571
12573
  var custom_tag_default = {
12572
12574
  analyze: {
12573
12575
  enter(tag) {
12574
- const templateFile = (0, import_babel_utils50.getTagTemplate)(tag);
12576
+ const templateFile = (0, import_babel_utils51.getTagTemplate)(tag);
12575
12577
  if (!templateFile) throw tagNotFoundError(tag);
12576
- (0, import_babel_utils50.assertAttributesOrSingleArg)(tag);
12577
- const childFile = (0, import_babel_utils50.loadFileForTag)(tag);
12578
+ (0, import_babel_utils51.assertAttributesOrSingleArg)(tag);
12579
+ const childFile = (0, import_babel_utils51.loadFileForTag)(tag);
12578
12580
  if (!childFile) {
12579
12581
  throw tag.get("name").buildCodeFrameError("Unable to resolve file for tag.");
12580
12582
  }
12581
- const programExtra = (0, import_babel_utils50.getProgram)().node.extra;
12583
+ const programExtra = (0, import_babel_utils51.getProgram)().node.extra;
12582
12584
  const programSection = programExtra.section;
12583
12585
  const childProgram = childFile.ast.program;
12584
12586
  const childExtra = childProgram.extra;
@@ -12610,12 +12612,12 @@ var custom_tag_default = {
12610
12612
  };
12611
12613
  function translateHTML(tag) {
12612
12614
  const { node } = tag;
12613
- const childProgram = (0, import_babel_utils50.loadFileForTag)(tag).ast.program;
12615
+ const childProgram = (0, import_babel_utils51.loadFileForTag)(tag).ast.program;
12614
12616
  const childExtra = childProgram.extra;
12615
12617
  let tagIdentifier;
12616
12618
  if (import_compiler61.types.isStringLiteral(node.name)) {
12617
12619
  const relativePath = getTagRelativePath(tag);
12618
- tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler61.types.identifier(getTemplateContentName()) : (0, import_babel_utils50.importDefault)(tag.hub.file, relativePath, getTagName(tag));
12620
+ tagIdentifier = isCircularRequest(tag.hub.file, relativePath) ? import_compiler61.types.identifier(getTemplateContentName()) : (0, import_babel_utils51.importDefault)(tag.hub.file, relativePath, getTagName(tag));
12619
12621
  } else {
12620
12622
  tagIdentifier = node.name;
12621
12623
  }
@@ -12631,8 +12633,8 @@ function translateDOM(tag) {
12631
12633
  const { file } = tag.hub;
12632
12634
  const write = writeTo(tag);
12633
12635
  const relativePath = getTagRelativePath(tag);
12634
- const programSection = (0, import_babel_utils50.getProgram)().node.extra.section;
12635
- const childFile = (0, import_babel_utils50.loadFileForTag)(tag);
12636
+ const programSection = (0, import_babel_utils51.getProgram)().node.extra.section;
12637
+ const childFile = (0, import_babel_utils51.loadFileForTag)(tag);
12636
12638
  const childExtra = childFile.ast.program.extra;
12637
12639
  const childExports = childExtra.domExports;
12638
12640
  const childSection = childExtra.section;
@@ -12686,11 +12688,11 @@ function translateDOM(tag) {
12686
12688
  );
12687
12689
  }
12688
12690
  );
12689
- write`${(0, import_babel_utils50.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
12691
+ write`${(0, import_babel_utils51.importNamed)(file, relativePath, childExports.template, `${tagName}_template`)}`;
12690
12692
  injectWalks(
12691
12693
  tag,
12692
12694
  tagName,
12693
- (0, import_babel_utils50.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
12695
+ (0, import_babel_utils51.importNamed)(file, relativePath, childExports.walks, `${tagName}_walks`)
12694
12696
  );
12695
12697
  }
12696
12698
  tag.remove();
@@ -12702,8 +12704,8 @@ function getTagRelativePath(tag) {
12702
12704
  } = tag;
12703
12705
  let relativePath;
12704
12706
  if (import_compiler61.types.isStringLiteral(node.name)) {
12705
- const template = node.extra?.featureType === "class" && (0, import_babel_utils50.getTagDef)(tag)?.renderer || (0, import_babel_utils50.getTagTemplate)(tag);
12706
- relativePath = template && (0, import_babel_utils50.resolveRelativePath)(file, template);
12707
+ const template = node.extra?.featureType === "class" && (0, import_babel_utils51.getTagDef)(tag)?.renderer || (0, import_babel_utils51.getTagTemplate)(tag);
12708
+ relativePath = template && (0, import_babel_utils51.resolveRelativePath)(file, template);
12707
12709
  } else if (node.extra?.tagNameImported) {
12708
12710
  relativePath = node.extra.tagNameImported;
12709
12711
  }
@@ -12735,7 +12737,7 @@ function importOrSelfReferenceName(file, request, name2, nameHint) {
12735
12737
  if (isCircularRequest(file, request)) {
12736
12738
  return import_compiler61.types.identifier(name2);
12737
12739
  }
12738
- return (0, import_babel_utils50.importNamed)(file, request, name2, nameHint);
12740
+ return (0, import_babel_utils51.importNamed)(file, request, name2, nameHint);
12739
12741
  }
12740
12742
  function isCircularRequest(file, request) {
12741
12743
  const { filename } = file.opts;
@@ -12744,14 +12746,14 @@ function isCircularRequest(file, request) {
12744
12746
 
12745
12747
  // src/translator/visitors/tag/dynamic-tag.ts
12746
12748
  var import_compiler62 = require("@marko/compiler");
12747
- var import_babel_utils51 = require("@marko/compiler/babel-utils");
12749
+ var import_babel_utils52 = require("@marko/compiler/babel-utils");
12748
12750
  var kDOMBinding3 = /* @__PURE__ */ Symbol("dynamic tag dom binding");
12749
12751
  var kChildOffsetScopeBinding2 = /* @__PURE__ */ Symbol("custom tag scope offset");
12750
12752
  var importedDynamicTagResume = /* @__PURE__ */ new WeakSet();
12751
12753
  var dynamic_tag_default = {
12752
12754
  analyze: {
12753
12755
  enter(tag) {
12754
- (0, import_babel_utils51.assertAttributesOrArgs)(tag);
12756
+ (0, import_babel_utils52.assertAttributesOrArgs)(tag);
12755
12757
  const { node } = tag;
12756
12758
  const definedBodySection = node.extra?.defineBodySection;
12757
12759
  if (definedBodySection) {
@@ -12778,7 +12780,7 @@ var dynamic_tag_default = {
12778
12780
  if (hasVar || tag.node.attributes.some(
12779
12781
  (attr) => import_compiler62.types.isMarkoSpreadAttribute(attr) || isEventOrChangeHandler(attr.name)
12780
12782
  )) {
12781
- (0, import_babel_utils51.getProgram)().node.extra.isInteractive = true;
12783
+ (0, import_babel_utils52.getProgram)().node.extra.isInteractive = true;
12782
12784
  }
12783
12785
  if (hasVar) {
12784
12786
  trackVarReferences(tag, 5 /* derived */);
@@ -12791,7 +12793,12 @@ var dynamic_tag_default = {
12791
12793
  },
12792
12794
  translate: {
12793
12795
  enter(tag) {
12794
- if (tag.node.extra?.defineBodySection) {
12796
+ const tagExtra = tag.node.extra;
12797
+ if (tagExtra?.featureType === "class" && !isOutputHTML() && !(0, import_babel_utils52.getTagTemplate)(tag)) {
12798
+ tag.remove();
12799
+ return;
12800
+ }
12801
+ if (tagExtra?.defineBodySection) {
12795
12802
  if (isOutputHTML()) {
12796
12803
  flushBefore(tag);
12797
12804
  }
@@ -12877,40 +12884,64 @@ var dynamic_tag_default = {
12877
12884
  const isClassAPI = tagExtra.featureType === "class";
12878
12885
  let tagExpression = node.name;
12879
12886
  if (import_compiler62.types.isStringLiteral(tagExpression)) {
12880
- tagExpression = (0, import_babel_utils51.importDefault)(
12887
+ tagExpression = (0, import_babel_utils52.importDefault)(
12881
12888
  tag.hub.file,
12882
12889
  getTagRelativePath(tag),
12883
12890
  tagExpression.value
12884
12891
  );
12885
12892
  }
12886
12893
  if (isClassAPI) {
12887
- if (isOutputHTML()) {
12888
- (0, import_babel_utils51.getProgram)().node.body.push(
12894
+ if ((0, import_babel_utils52.getTagTemplate)(tag)) {
12895
+ if (getSerializeReason(tagSection, nodeBinding)) {
12896
+ if (isOutputHTML()) {
12897
+ (0, import_babel_utils52.getProgram)().node.body.push(
12898
+ import_compiler62.types.markoScriptlet(
12899
+ [
12900
+ import_compiler62.types.expressionStatement(
12901
+ import_compiler62.types.callExpression(
12902
+ (0, import_babel_utils52.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
12903
+ [
12904
+ import_compiler62.types.identifier(tagExpression.name),
12905
+ import_compiler62.types.stringLiteral(
12906
+ (0, import_babel_utils52.loadFileForTag)(tag).metadata.marko.id
12907
+ )
12908
+ ]
12909
+ )
12910
+ )
12911
+ ],
12912
+ true
12913
+ )
12914
+ );
12915
+ } else {
12916
+ (0, import_babel_utils52.getProgram)().node.body.push(
12917
+ import_compiler62.types.expressionStatement(
12918
+ callRuntime(
12919
+ "_resume",
12920
+ import_compiler62.types.stringLiteral((0, import_babel_utils52.loadFileForTag)(tag).metadata.marko.id),
12921
+ import_compiler62.types.identifier(tagExpression.name)
12922
+ )
12923
+ )
12924
+ );
12925
+ }
12926
+ }
12927
+ } else {
12928
+ (0, import_babel_utils52.getProgram)().node.body.push(
12889
12929
  import_compiler62.types.markoScriptlet(
12890
12930
  [
12891
12931
  import_compiler62.types.expressionStatement(
12892
- import_compiler62.types.callExpression(
12893
- (0, import_babel_utils51.importNamed)(tag.hub.file, getCompatRuntimeFile(), "s"),
12894
- [
12932
+ import_compiler62.types.assignmentExpression(
12933
+ "??=",
12934
+ import_compiler62.types.memberExpression(
12895
12935
  import_compiler62.types.identifier(tagExpression.name),
12896
- import_compiler62.types.stringLiteral((0, import_babel_utils51.loadFileForTag)(tag).metadata.marko.id)
12897
- ]
12936
+ import_compiler62.types.identifier("_")
12937
+ ),
12938
+ import_compiler62.types.identifier(tagExpression.name)
12898
12939
  )
12899
12940
  )
12900
12941
  ],
12901
12942
  true
12902
12943
  )
12903
12944
  );
12904
- } else {
12905
- (0, import_babel_utils51.getProgram)().node.body.push(
12906
- import_compiler62.types.expressionStatement(
12907
- callRuntime(
12908
- "_resume",
12909
- import_compiler62.types.stringLiteral((0, import_babel_utils51.loadFileForTag)(tag).metadata.marko.id),
12910
- import_compiler62.types.identifier(tagExpression.name)
12911
- )
12912
- )
12913
- );
12914
12945
  }
12915
12946
  }
12916
12947
  const { properties, statements } = translateAttrs(
@@ -13064,7 +13095,7 @@ var dynamic_tag_default = {
13064
13095
  }
13065
13096
  };
13066
13097
  function enableDynamicTagResume(tag) {
13067
- const program = (0, import_babel_utils51.getProgram)().node;
13098
+ const program = (0, import_babel_utils52.getProgram)().node;
13068
13099
  if (!importedDynamicTagResume.has(program) && analyzeTagNameType(tag, true) !== 1 /* CustomTag */) {
13069
13100
  for (const attr of tag.node.attributes) {
13070
13101
  if (attr.type === "MarkoSpreadAttribute" || attr.type === "MarkoAttribute" && isEventOrChangeHandler(attr.name)) {
@@ -13082,7 +13113,7 @@ function enableDynamicTagResume(tag) {
13082
13113
  var tag_default = {
13083
13114
  analyze: {
13084
13115
  enter(tag) {
13085
- const tagDef = (0, import_babel_utils52.getTagDef)(tag);
13116
+ const tagDef = (0, import_babel_utils53.getTagDef)(tag);
13086
13117
  const type = analyzeTagNameType(tag);
13087
13118
  const hook = tagDef?.analyzer?.hook;
13088
13119
  if (hook) {
@@ -13106,7 +13137,7 @@ var tag_default = {
13106
13137
  }
13107
13138
  },
13108
13139
  exit(tag) {
13109
- const hook = (0, import_babel_utils52.getTagDef)(tag)?.analyzer?.hook;
13140
+ const hook = (0, import_babel_utils53.getTagDef)(tag)?.analyzer?.hook;
13110
13141
  if (hook) {
13111
13142
  exit(hook, tag);
13112
13143
  return;
@@ -13115,7 +13146,7 @@ var tag_default = {
13115
13146
  },
13116
13147
  translate: {
13117
13148
  enter(tag) {
13118
- const tagDef = (0, import_babel_utils52.getTagDef)(tag);
13149
+ const tagDef = (0, import_babel_utils53.getTagDef)(tag);
13119
13150
  if (tagDef?.translator) {
13120
13151
  if (tagDef.translator.path) {
13121
13152
  tag.hub.file.metadata.marko.watchFiles.push(tagDef.translator.path);
@@ -13148,7 +13179,7 @@ var tag_default = {
13148
13179
  }
13149
13180
  },
13150
13181
  exit(tag) {
13151
- const translator = (0, import_babel_utils52.getTagDef)(tag)?.translator;
13182
+ const translator = (0, import_babel_utils53.getTagDef)(tag)?.translator;
13152
13183
  if (translator) {
13153
13184
  exit(translator.hook, tag);
13154
13185
  return;
@@ -13186,12 +13217,12 @@ var text_default = {
13186
13217
 
13187
13218
  // src/translator/interop/index.ts
13188
13219
  var import_compiler65 = require("@marko/compiler");
13189
- var import_babel_utils54 = require("@marko/compiler/babel-utils");
13220
+ var import_babel_utils55 = require("@marko/compiler/babel-utils");
13190
13221
  var import_babel2 = require("@marko/compiler/internal/babel");
13191
13222
  var import_path6 = __toESM(require("path"));
13192
13223
 
13193
13224
  // src/translator/interop/feature-detection.ts
13194
- var import_babel_utils53 = require("@marko/compiler/babel-utils");
13225
+ var import_babel_utils54 = require("@marko/compiler/babel-utils");
13195
13226
 
13196
13227
  // src/translator/interop/build-aggregate-error.ts
13197
13228
  var import_babel = require("@marko/compiler/internal/babel");
@@ -13248,12 +13279,12 @@ function getFileNameWithLoc(fileName, { node: { loc } }) {
13248
13279
  }
13249
13280
 
13250
13281
  // src/translator/interop/feature-detection.ts
13251
- function isTagsAPI(file = (0, import_babel_utils53.getFile)()) {
13282
+ function isTagsAPI(file = (0, import_babel_utils54.getFile)()) {
13252
13283
  const program = file.path;
13253
13284
  const programExtra = program.node.extra ??= {};
13254
13285
  let { featureType } = programExtra;
13255
13286
  if (!featureType) {
13256
- const lookup = (0, import_babel_utils53.getTaglibLookup)(file);
13287
+ const lookup = (0, import_babel_utils54.getTaglibLookup)(file);
13257
13288
  const tagsDir = getTagsDir(file.opts.filename);
13258
13289
  const state = {};
13259
13290
  if (tagsDir && !lookup.manualTagsDirs?.has(tagsDir)) {
@@ -13334,7 +13365,7 @@ function scanTag(state, tag) {
13334
13365
  tag.get("var")
13335
13366
  );
13336
13367
  }
13337
- const tagDef = (0, import_babel_utils53.getTagDef)(tag);
13368
+ const tagDef = (0, import_babel_utils54.getTagDef)(tag);
13338
13369
  if (tagDef) {
13339
13370
  if (tagDef.name === "style") {
13340
13371
  if (/^style(?:(?:\.[^.\s\\/:*?"<>|({]+)+)?\s*\{/.test(
@@ -13516,7 +13547,7 @@ function createInteropTranslator(translate5) {
13516
13547
  return enterProgram?.call(this, program, state);
13517
13548
  }
13518
13549
  const visitedFiles = /* @__PURE__ */ new Set([
13519
- (0, import_babel_utils54.resolveRelativePath)(entryFile, entryFile.opts.filename)
13550
+ (0, import_babel_utils55.resolveRelativePath)(entryFile, entryFile.opts.filename)
13520
13551
  ]);
13521
13552
  entryBuilder.visit(
13522
13553
  entryFile,
@@ -13524,12 +13555,12 @@ function createInteropTranslator(translate5) {
13524
13555
  function visitChild(resolved) {
13525
13556
  if (!visitedFiles.has(resolved)) {
13526
13557
  visitedFiles.add(resolved);
13527
- const file = (0, import_babel_utils54.loadFileForImport)(entryFile, resolved);
13558
+ const file = (0, import_babel_utils55.loadFileForImport)(entryFile, resolved);
13528
13559
  if (file) {
13529
13560
  entryBuilder.visit(
13530
13561
  file,
13531
13562
  entryFile,
13532
- (id) => visitChild(resolveRelativeToEntry2(entryFile, file, id))
13563
+ (id) => visitChild(resolveRelativeToEntry(entryFile, file, id))
13533
13564
  );
13534
13565
  }
13535
13566
  }
@@ -13680,12 +13711,6 @@ function getVisitorEnter(visit2) {
13680
13711
  function getVisitorExit(visit2) {
13681
13712
  return typeof visit2 === "object" ? visit2?.exit : void 0;
13682
13713
  }
13683
- function resolveRelativeToEntry2(entryFile, file, req) {
13684
- return file === entryFile ? (0, import_babel_utils54.resolveRelativePath)(file, req) : (0, import_babel_utils54.resolveRelativePath)(
13685
- entryFile,
13686
- req[0] === "." ? import_path6.default.join(file.opts.filename, "..", req) : req
13687
- );
13688
- }
13689
13714
 
13690
13715
  // src/translator/index.ts
13691
13716
  var visitors = extractVisitors({